views:

20

answers:

1

I've got a legacy VB6 app that I recently added SetWindowPos to the application to keep it on top. Long story why, but customer requested it.

On "normal" Windows machines (2000, XP) it keeps the window on top, but on the Server, it does not. Does anyone have any idea why? Are there any security settings, patches, etc that have disabled calling this on servers or operating systems? I have Googled this as well as searched StackOverflow, but I did not find anything.

Thanks...

A: 

There are two hints in the API documentation for SetWindowPos.

  • "To use SetWindowPos to bring a window to the top, the process that owns the window must have SetForegroundWindow permission." See here for a discussion of those rules.
  • "As part of the Vista re-architecture, all services were moved off the interactive desktop into Session 0. hWnd and window manager operations are only effective inside a session" - but presumably this app is not a service.
MarkJ
This got me pointed in the right direction. I ended up having to call SetForegroundWindow, SetWindowPos ***TWICE*** to get past my problem.
Jeff
@Jeff Odd. Very odd. Still, I'm glad if my random snippets indicated some other API calls to experiment with!
MarkJ