1

I need to check if my application is hidden behind any other windows / lost focus. Basically i have an application and if an event occurs and the application is not focused i can flash the window.

I actually wrote this a few month ago but lost the source, before i used something simple like application.focused, although for the life of me can't remember what it was. Thanks

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Guernica
  • 246
  • 5
  • 21

1 Answers1

1

You can use GetActiveWindow to get the hWnd of the active window and then compare it to the hWnd of your window. If you don't already know the hWnd of your window you can use Control.Handle or FindWindowEx to get it.

If you need to check if your window is set to be top-most, there's sample code at the bottom of getwindowlong on pinvoke in C# but you should be able to write the VB equivalent from the content given in the rest of the page.

jzonthemtn
  • 3,344
  • 1
  • 21
  • 30