By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,313 Members | 1,145 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,313 IT Pros & Developers. It's quick & easy.

setting foreground window when no user is actively logged in

P: n/a
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
Oct 18 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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?

"Stephan Steiner" wrote:
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
Oct 19 '07 #2

P: n/a
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
"Family Tree Mike" <Fa************@discussions.microsoft.comwrote in
message news:D2**********************************@microsof t.com...
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?

Oct 19 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.