forse sono stato poco chiaro ma ti avevo già risposto nell'altro tuo recente 3D: la funzione che ti serve è SetErrorMode. e guarda http://msdn.microsoft.com/ se non hai il compilatore originale.
prova questo codice (naturalmente non l'ho testato):
codice:BOOL IsDriveAReady() { // Tell the system to NOT display a message box when it fails to find a file... UINT nOldMode = SetErrorMode(SEM_NOOPENFILEERRORBOX); HANDLE hFile; hFile = CreateFile( "\\\\.\\A:", // open drive A: GENERIC_READ, // open for reading FILE_SHARE_READ|FILE_SHARE_WRITE, // MUST also share for writing NULL, // no security OPEN_EXISTING, // existing file only FILE_ATTRIBUTE_NORMAL, // normal file NULL); // no attr. template if (hFile == INVALID_HANDLE_VALUE) { // PROCESS ERROR HERE return FALSE; } else { CloseHandle(hFile); } SetErrorMode(nOldMode); return TRUE; }

Rispondi quotando