-
- //---------------------------------------------------------------------
- // isDiskInDrive.c
- //---------------------------------------------------------------------
-
- #include <windows.h>
-
-
- //---------------------------------------------------------------------
- BOOL isDiskInDrive(void)
- {
- WIN32_FIND_DATA ffd = {0};
- UINT pem = SetErrorMode(SEM_FAILCRITICALERRORS);
- HANDLE hff = FindFirstFile( "A:\\*.*", &ffd );
- BOOL bok = GetLastError() != ERROR_NOT_READY;
-
- if(hff != INVALID_HANDLE_VALUE) FindClose(hff);
- SetErrorMode(pem);
- return bok;
- }
-
-
- //--------------------------------------------------------------------
- int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hpinst, LPSTR p, int n )
- {
- int reponse;
- MSGBOXPARAMS mbp = {sizeof(MSGBOXPARAMS)};
-
- mbp.hInstance = LoadLibrary("Shell32");
- mbp.lpszCaption = "isDiskInDrive";
- mbp.dwStyle = MB_RETRYCANCEL | MB_DEFBUTTON1 | MB_USERICON;
-
- do
- {
- if(isDiskInDrive())
- {
- mbp.lpszIcon = MAKEINTRESOURCE(8);
- mbp.lpszText = "Il y a une disquette dans le lecteur A: ";
- reponse = MessageBoxIndirect(&mbp);
-
- }
- else
- {
- mbp.lpszIcon = MAKEINTRESOURCE(7);
- mbp.lpszText = "Il n'y a pas de disquette dans le lecteur A: ";
- reponse = MessageBoxIndirect(&mbp);
- }
- }while(reponse == IDRETRY);
-
- FreeLibrary(mbp.hInstance);
- return 0;
- }
//---------------------------------------------------------------------
// isDiskInDrive.c
//---------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------
BOOL isDiskInDrive(void)
{
WIN32_FIND_DATA ffd = {0};
UINT pem = SetErrorMode(SEM_FAILCRITICALERRORS);
HANDLE hff = FindFirstFile( "A:\\*.*", &ffd );
BOOL bok = GetLastError() != ERROR_NOT_READY;
if(hff != INVALID_HANDLE_VALUE) FindClose(hff);
SetErrorMode(pem);
return bok;
}
//--------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hpinst, LPSTR p, int n )
{
int reponse;
MSGBOXPARAMS mbp = {sizeof(MSGBOXPARAMS)};
mbp.hInstance = LoadLibrary("Shell32");
mbp.lpszCaption = "isDiskInDrive";
mbp.dwStyle = MB_RETRYCANCEL | MB_DEFBUTTON1 | MB_USERICON;
do
{
if(isDiskInDrive())
{
mbp.lpszIcon = MAKEINTRESOURCE(8);
mbp.lpszText = "Il y a une disquette dans le lecteur A: ";
reponse = MessageBoxIndirect(&mbp);
}
else
{
mbp.lpszIcon = MAKEINTRESOURCE(7);
mbp.lpszText = "Il n'y a pas de disquette dans le lecteur A: ";
reponse = MessageBoxIndirect(&mbp);
}
}while(reponse == IDRETRY);
FreeLibrary(mbp.hInstance);
return 0;
}