setting foreground window when no user is actively logged in

S

Stephan Steiner

Hi

I need to start a GUI application from a console app. Upon startup, the
application can display one or two popups, which need clicking away. I have
all this handled using FindWindow, GetDLGCtrlID and PostMessage respectively
(find window, find control ID of the button that needs pressing, and press
the button).

However, the software in question will only bring up the popup if it is in
the foreground. So I'm using GetForegroundWindow to find the window that
currently has focus, and if it's not the one I need to have focus, I call
SetForegroundWindow to give the proper window focus.

So far, everything is still good. However, now, the app needs to keep on
running if no user is in front of the computer. And as soon as the screen is
locked, SetForegroundWindow does nothing.. so the app starts minimized and
remains so and the popup never comes up - and thus the application never
starts up properly. Is there a way to bring an application in front even if
the screen is locked (we assume some interactive user is logged in.. we're
not looking at a situation where there's no active user session ).

Regards
Stephan
 
G

Guest

Stephan,

I guess I am missing something obvious, but how is the console application
started if the screen is locked? In other words, no one would be able to
type or run the console application, right?
 
S

Stephan Steiner

Here's how it works - the machine is set up to automatically log in a user
upon startup, and then launch the application.

For now, after the machine is started, a user logs in, and starts the
application manually. As long as you don't log out again, the application
keeps on running. Once that works we'll look at running the cli app from a
service.. we'll see if it works but eve nif it doesn't, we can still use the
approach described above.

Regards
Stephan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top