3

TL;DR Can I make a VB.net form visible on the Windows lock screen [i.e. when a user hits WIN+L]?


I wrote an alert system that notifies staff of a 'lockdown' in vb.net. This has been tested in drills a few times but today it was noted that the 'alert window' does not appear when the screen is locked.

The alert window does make an alarm sound, which can still be heard even when the computer is locked but this is dependant on the machine having speakers that are turned on...

The workstations are running Windows 7.

Edit

I am not looking to spawn a separate process, just get the 'lockdown.vb' form showing on top of the windows lock screen.

Googling this has just given me a load of tutorials on making a lockscreen...which is not what I'm after, hence the question. :-)

Robin Wright
  • 303
  • 1
  • 12
  • You mean on Windows 8+ Lock Screen? If this is the case, see: [Windows Lock Screen display text programmatically](https://stackoverflow.com/questions/46528041/windows-lock-screen-display-text-programmatically-c-sharp). `vb.net` code samples here: [Lock screen apps sample](https://code.msdn.microsoft.com/windowsapps/Lock-screen-apps-sample-9843dc3a) – Jimi Apr 10 '18 at 13:05
  • @Jimi We run windows 7 at the moment. Sorry, I should have specified! I will edit the question. – Robin Wright Apr 10 '18 at 14:00
  • Well why wouldn't making a lockscreen work? – djv Apr 10 '18 at 14:07
  • 2
    Here's a Windows 7 solution (C#): http://stackoverflow.com/a/3143055 -- Sadly the answerer didn't include the P/Invoke or structure declarations, so you'll have to look them up yourself at https://pinvoke.net/ – Visual Vincent Apr 10 '18 at 14:10
  • @djv We currently enforce the windows native lockscreen via group policy. We don't want to go changing that. – Robin Wright Apr 10 '18 at 14:31
  • @VisualVincent Interesting, I didn't consider spawning a separate process. I will look into that. - I am not familiar with C# but I gather is it interchangeable with VB.NET. – Robin Wright Apr 10 '18 at 14:32
  • Not a 100%, but pretty much. You can usually convert between them: http://converter.telerik.com/ – Visual Vincent Apr 10 '18 at 14:34
  • @VisualVincent Not sure it does what I need. It would allow me to spawn a new process, but as my app is already running that means it would be running twice? – Robin Wright Apr 10 '18 at 14:47
  • There's no other way. You might be able to tweak your process into restarting itself with the right privileges when the user first launches it, but that would also impose a security risk. Either make a new application that consists only of the alert window, or add a flag to your current application that opens the alert window if set (for instance: `yourapp.exe -alert "Message here"`). Then just launch that in the lockscreen. – Visual Vincent Apr 10 '18 at 15:05
  • 1
    Note that you cannot move just a single window to the lockscreen (which is why it's best to start a new process). These so-called _secure desktops_ (the lockscreen, for example) require you to bind your app's entire UI thread to them, thus all your windows. Read more here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms682573(v=vs.85).aspx – Visual Vincent Apr 10 '18 at 15:09
  • Ok @VisualVincent, that does make sense. Thank you for your help. – Robin Wright Apr 11 '18 at 08:05

0 Answers0