Hi,
I am implementing a single instance MFC app and am following the guide from
http://support.microsoft.com/default.aspx?scid=kb;en-us;243953. What I also
want to do is, whenever an instance of my app is already running, I want to
flash the window. Here is part of the code from InitInstance():
...
if (g_SingleInstanceObj.IsAnotherInstanceRunning())
{
AfxMessageBox(_T("An instance already running."));
FLASHWINFO fwi;
fwi.cbSize = sizeof(FLASHWINFO);
fwi.hwnd = /* How do I get a handle of the running instance? */
fwi.dwFlags = FLASHW_ALL;
fwi.uCount = 25;
fwi.dwTimeout = 0;
FlashWindowEx(&fwi);
return FALSE;
}
...
I know I can call "FindWindow()" to get the HWND of the running instance,
but I am kind of hate of passing the "title" of the window. Is there any
other way to get HWND of the running instance besides calling "FindWindow()"?
Please advice, thanks!
-P