在主程式 WinMain() 加入下面程式碼
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
HANDLE hMutex;
// 設定互斥旗標所識別的應用程式名稱
const char pProgName[]="~!@#$%^project1";
try {
// 取得互斥旗標的狀態
hMutex=OpenMutex(MUTEX_ALL_ACCESS, false, pProgName);
if ( NULL==hMutex ) {
// 設定互斥旗標所識別的應用程式名稱
hMutex=CreateMutex(NULL, true, pProgName);
}
else {
// 系統中已開啟一份應用程式了,因此不啟動本程式
return 0;
}
Application->Initialize();
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch ( ... ) {
...
}
// **** 加入部份
// 釋放互斥旗標
return ReleaseMutex(hMutex);
}
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch ( ... ) {
...
}
// **** 加入部份
// 釋放互斥旗標
return ReleaseMutex(hMutex);
}
In this post, we'll look at how choose on} wholesale products for resale and the place you can to|you possibly can} go to find out|to search out} them. When you find an excellent wholesale provider and get a high-quality product at a low worth, it is extremely worthwhile. rose sex toy If you need help sourcing from China companies, please don’t hesitate to contact us.
ReplyDelete