Search for the drive

xiaoxiao2021-03-06  37

Void FindriverInfo ()

{

CCOMBOBOX * DRIVER = (ccomboBox *) getdlgitem (IDC_DRIVER);

DWORD DWNUMBYTESFORDRIVESTRINGS;

Handle hheap;

LPSTR LP;

Cstring strlogdrive;

INT nnumdrives = 0, NDrivenum;

DwnumBytesfordriveStrings = getLogicalDriveStrings (0, null)

* sizeof (tchar); // actually store the string length of the drive letter

IF (DwnumBytesfordriveStrings! = 0) {

HHEAP = getProcessheap ();

LP = (lpstr) Heapalloc (hheap, heap_zero_memory,

DwnumBytesfordriveStrings); //

GetLogicalDriveStrings (Heapsize (HHEAP, 0, LP), LP);

StringBox.setsize (dwnumbytesfordriveStrings / sizeof (tchar) 1);

While (* lp! = 0) {

IF (GetDriveType (LP) == Drive_removable) {

Driver-> addstring (lp);

StringBox [nnumdrives] = lp;

NNUMDRIVES ;

}

LP = _TCSCHR (LP, 0) 1;

}

}

Else AfxMessageBox ("Can't Use The Function GetLogicalDriveStrings!");

}

转载请注明原文地址:https://www.9cbs.com/read-63419.html

New Post(0)