| |
|
|
C++ Builder / Une seule instance
d'application
- WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
- {
- HANDLE hMutex;
-
- try
- {
- hMutex = CreateMutex (NULL,FALSE,"Mon application");
-
- if ( (hMutex == NULL) || (GetLastError()
== ERROR_ALREADY_EXISTS) )
- {
- //--- Fermeture du Mutex
- CloseHandle(hMutex);
- return 0;
- }
-
- Application->Initialize();
- Application->CreateForm(__classid(TfwMenu), &fwMenu);
- Application->Run();
-
- }
-
- catch ( Exception &exception
)
- {
- Application->ShowException ( &exception );
- }
-
- //--- Fermeture du Mutex
- CloseHandle(hMutex);
-
- return 0;
- }
|