Single instance doesn't restore automatically

Ask any support questions here
Post Reply
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Single instance doesn't restore automatically

Post 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?
shootist
Posts: 45
Joined: Tue Jan 18, 2011 5:11 am

Re: Single instance doesn't restore automatically

Post 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.
twinsen
Posts: 109
Joined: Mon Dec 27, 2010 3:17 pm

Re: Single instance doesn't restore automatically

Post 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.
David Erceg
Site Admin
Posts: 938
Joined: Sat Apr 18, 2009 1:46 am

Re: Single instance doesn't restore automatically

Post 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);
Post Reply