Page 1 of 1

Single instance doesn't restore automatically

Posted: Thu Jan 27, 2011 11:38 am
by twinsen
Sometimes when you open a folder (eg "explorer++.exe c:\tmp") with multiple instances disabled the existing instance taskbar entry just flashes orange - it does not restore the window. But it does correctly open the directory. Its a bit annoying it does not restore the window. You have to manually restore it. I've seen these kind of problems before when trying to bring a window in front of others across processes. Does this ever happen with windows 7?

Re: Single instance doesn't restore automatically

Posted: Fri Jan 28, 2011 12:38 am
by shootist
Not really sure what you are talking about but if it is what happens when doing a Alt Tab to switch between windows, open programs, and even though a program has focus it is not full displayed in front of other programs, IE covered up by non active programs/windows, then yes I see this from time to time on Win 7.

If you are talking strictly about E++ I rarely have 2 instances of it open and the few times I have I had no problem switching between them, IIRC.

Re: Single instance doesn't restore automatically

Posted: Sat Jan 29, 2011 1:53 pm
by twinsen
How to reproduce (Windows XP):
* Run Explorer++ in single instance mode.
* Open notepad and fill the screen, with notepad the active task.
* Run "explorer++.exe c:\tmp" - it opens the directory, but does not bring the window forward.

This is not enough to make Explorer++ the foreground window (from WinMain.cpp in single instance mode):

Code: Select all

hPrev = FindWindow(CLASS_NAME,NULL);
SetForegroundWindow(hPrev);
ShowWindow(hPrev,SW_SHOW);
It sounds like its not enough on Windows7 either.
I'll try and dig up the code that can bring a window to the front.

Re: Single instance doesn't restore automatically

Posted: Mon Jan 31, 2011 1:49 am
by David Erceg
I can duplicate this by minimizing the current instance of Explorer++, then attempting to start a new instance. To fix it, I simply changed:

Code: Select all

ShowWindow(hPrev,SW_SHOW);
to

Code: Select all

ShowWindow(hPrev,SW_RESTORE);