How to activate a window in Windows 2003?
-
I have a program which only allow one instance under windows. If a user clicked the program link when the program have already started, the new program instance will activate the old running program. My code:
@//only allow to run one single instance
HANDLE hMutex = CreateMutex(NULL, TRUE, TEXT("ChavSoftRecorderServer"));
if (ERROR_ALREADY_EXISTS == GetLastError()) {
HWND hWnd = FindWindow(NULL, TEXT("畅远信息录音系统-服务端"));
ShowWindow(hWnd, SW_SHOWDEFAULT);
SetForegroundWindow(hWnd);
return 0;
}@
But the result turn out to be t!http://i.imgur.com/eesVp.jpg(result)!I have write a sample using MFC and the same mutex code as above. The MFC edition works fine under both win7 and 2003.
But qt version only works fine under win7. -
Can you please show the Qt version of your program to us?