Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / October 2007

Tip: Looking for answers? Try searching our database.

setting foreground window when no user is actively logged in

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stephan Steiner - 18 Oct 2007 21:48 GMT
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
Family Tree Mike - 19 Oct 2007 03:01 GMT
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?

> Hi
>
[quoted text clipped - 19 lines]
> Regards
> Stephan
Stephan Steiner - 19 Oct 2007 13:37 GMT
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
> 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?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.