Answer the question
In order to leave comments, you need to log in
How to pass a variable obtained with GetLogicalDrives() to GetDriveType()?
Recently I started to study c++ and win api, the following question arose:
is it possible, having received a bitmask of available drives, to form a drive name and pass it to GetDriveType() to determine its type?
those. something like this:
DWORD drives = GetLogicalDrives();
LPCWSTR d[4];
int n;
for (int i = 0; i < 26; i++) {
n = ((drives >> i) & 0x00000001);
if (n == 1) {
d[0] = LPCWSTR(65 + i); // символ диска
d[1] = L":";
d[2] = L"\\";
d[3] = L"\0";
driveType = GetDriveType(*d);
cout << driveType << endl;
}
}
Answer the question
In order to leave comments, you need to log in
You need to learn what arrays and strings are in C/C++ and how strings differ from characters. Well, carefully read the description of the API functions.
UINT WINAPI GetDriveType(
_In_opt_ LPCTSTR lpRootPathName
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question