www.pudn.com > crestroncontrol.rar > CloseOpenClient.cpp, change:2005-11-22,size:1189b


//--------------------------------------------------------------------------- 
 
#include <vcl.h> 
#pragma hdrstop 
//--------------------------------------------------------------------------- 
USEFORM("Main.cpp", FormMain); 
//--------------------------------------------------------------------------- 
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) 
{ 
    HANDLE hMutex = CreateMutex(NULL, false, "CloseOpenClient"); 
    if(hMutex==NULL || ERROR_ALREADY_EXISTS==::GetLastError()) 
    { 
        //MessageBox(NULL,"  系统已经在运行!     ","系统提示",MB_OK|MB_ICONINFORMATION); 
        return 0; 
    } 
 
    try 
    { 
         Application->Initialize(); 
         Application->CreateForm(__classid(TFormMain), &FormMain); 
         Application->Run(); 
    } 
    catch (Exception &exception) 
    { 
         Application->ShowException(&exception); 
    } 
    catch (...) 
    { 
         try 
         { 
             throw Exception(""); 
         } 
         catch (Exception &exception) 
         { 
             Application->ShowException(&exception); 
         } 
    } 
    return 0; 
} 
//---------------------------------------------------------------------------