WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
HANDLE hMutex=CreateMutex(NULL,false,"RunOnlyOneInstance");
if(hMutex==NULL||ERROR_ALREADY_EXISTS==::GetLastError())
{
return false;
}
Application->Initialize();
Application->Title = "";
Application->CreateForm(__classid(TfmMain), &fmMain);
Application->CreateForm(__classid(Tdm), &dm);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
转载于:https://www.cnblogs.com/hanny/archive/2011/04/12/2013136.html