views:

352

answers:

4

I have a program that occasionally pops up on the screen and displays a message, using vb.net. Is there a way to have it run and display even if the computer is locked or no one is logged on? Thanks.

+1  A: 

Simply put, no there is not.

JaredPar
Then how does the Cisco VPN Client and CRYPTOCard Authenticator run full applications after booting before anyone logs in? Or, is it just not possible in VB.NET?
HardCode
+1  A: 

A program (e.g., a service) can run if you're not logged in or the machine is in screen-saver mode, however it cannot interact with the screen. You could send, for example, an email/SMS/HTTP POST to another device if you wanted to alert somebody to something.

Bob Kaufman
+3  A: 

One way to partially work around this would be to write a screen saver that could poll a service for messages. The service would have to run at boot (NOT at login - because you might not have anyone logged in yet!).

The screen saver would have to be set to be the login screen saver as well as the user's screen saver, AND you'd need to set short screen saver timeouts on the login screens (I don't know how easy that is).

This would NOT get you messages popping up on the login screen, but if the login screen was idle long enough, it would go screen saver, and the screen saver could display the messages.

I'm not familiar at all with the environment in which screen savers run, so I don't know how much access they have. I assume they could open a pipe or shared memory segment on the local machine, which would be enough to get the job done.

Michael Kohne
+2  A: 

The only way I know that an application can pop up UI onto the logon screen is if they call the MessageBox API with the MB_SERVICENOTIFICATION flag. That flag is intended for use in system critical messages to alert the user at the console that something's gone horribly wrong so it will show up even if the machine is locked.

This isn't a dialog box, it's just a message box so there's no real security risk associated with the message box.

What makes this complicated is that Windows 95 and Windows NT used the same value for two flags - MB_TOPMOST and MB_SERVICENOTIFICATION. So if you're running a program designed for Windows 95, you might set the MB_TOPMOST flag and unexpectedly get the MB_SERVICENOTIFICATION behavior when run on Windows XP (and beyond). You can see this in the definition for the MB_SERVICENOTIFICATION flag in winuser.h:

#define MB_TOPMOST                       0x00040000L
#ifdef _WIN32_WINNT
#if (_WIN32_WINNT >= 0x0400)
#define MB_SERVICE_NOTIFICATION          0x00200000L
#else
#define MB_SERVICE_NOTIFICATION          0x00040000L
#endif
#define MB_SERVICE_NOTIFICATION_NT3X     0x00040000L
#endif
Larry Osterman
How much customization is available to this window?
Shawn
It's MessageBox. You get to set an icon, caption text, window text and you can control the buttons that get shown. The reason that it's safe for that window to be put on the secure desktop is because there is a highly restricted set of customizations that can be performed on it.
Larry Osterman