- NSIS Discussion
- Can't get SetForegroundWindow to work
Archive: Can't get SetForegroundWindow to work
helix400
7th May 2007 19:11 UTC
Can't get SetForegroundWindow to work
Hey all,
Thanks to the forums, I'm one step away from making an installer that does *everything* I want. (Which is why I love NSIS).
My last thing is getting SetForegroundWindow to work. Because of the UAC plugin, my installer window pops up behind the active window. I'd just like to call SetForegroundWindow to bring it up front
The line of code I'm using is thiis:
System::Call "user32::SetForegroundWindow(i $HWNDPARENT) i."
However, that doesn't seem to make it work. I've tried it at .onGuiInit, at the start of my main section, at the end of the section, etc. I just can't get the window to come up front. Any ideas on what I can do to fix this?
helix400
7th May 2007 20:41 UTC
No luck. :( Maybe my Windows Vista is preventing it, like the documentation said.
Red Wine
7th May 2007 20:55 UTC
Sorry... Although I have a small experience about vista, I'm on the side who claims that vista is just the new bubble (like windows me) from M$.
Anders
7th May 2007 21:37 UTC
if your call to SetForegroundWindow is correct, even if the window does not end up at the front, the taskbar icon should still flash. AllowSetForegroundWindow might be able to help you out if you can figure out the PID
helix400
7th May 2007 21:49 UTC
Yes, I did notice the taskbar flashing. If I get time, I'll check out the other API stuff
(Argh, Windows Vista sure is complicating things too much).
M-Force
15th October 2007 22:04 UTC
What is the final solution?
Hi helix400
could you please post you final solution about bringing the installer window to the front.
I am dealing with the same problem.
Thank you very much
M.
Anders
15th October 2007 23:43 UTC
There is no real solution, microsoft restricts SetForegroundWindow because of apps that abuse it, but, there was a hack added to the last version of the plugin, check it out and see if it helps
M-Force
16th October 2007 05:53 UTC
What plug-in?
Hi Anders,
thank you for the quick response.
When you are saying there is a new hack added to the last version of the plug-in, what plug-in do you mean.
What is the name/URL/link for the plug-in that your are mentioned?
Thanks
M.
Anders
16th October 2007 07:23 UTC
the uac plugin, thats what this thread is about, if you don't use the uac plugin, you can ignore this whole thread