Archive: Can't get SetForegroundWindow to work


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?


You may try BringToFront

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.14.1


No luck. :( Maybe my Windows Vista is preventing it, like the documentation said.


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$.


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


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).


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.


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


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.


the uac plugin, thats what this thread is about, if you don't use the uac plugin, you can ignore this whole thread