48. FAQ o Win API |
Q> How to check up, whether there is a diskette in the disk drive? A> BOOL IsDiskInDrive (LPTSTR lpszDrive)
{
UINT errmode;
TCHAR szVolName [256];
DWORD dwMaxComSize;
DWORD dwFlags;
TCHAR szFS [256];
BOOL bRes;
errmode = SetErrorMode (SEM_FAILCRITICALERRORS);
//if not to make SetErrorMode - the standard window "Drive Not Ready" jumps out
bRes = GetVolumeInformation (lpszDrive,
szVolName,
sizeof (szVolName),
NULL, &dwMaxComSize,
&dwFlags,
szFS, sizeof (szFS));
SetErrorMode (errmode);
return bRes;
}
This technology also works with CDROM and other replaceable devices.
|
2000 (c) DM