//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
try
{
HANDLE hMutex = CreateMutex ( NULL, false, "FanyuSingleProgram" ) ;
HANDLE windowhandle;
if (WaitForSingleObject(hMutex,0)==WAIT_TIMEOUT)
{
MessageBox(NULL,"你的程序已经启动","信息",MB_OK|MB_ICONINFORMATION);
exit (0);
}
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------