Hi Guys,
I need to know how to check whether my form is Active or Inactive, I mean whether my form's Window is Currently the Active Window or Inactive Window. Please Help me :(
Printable View
Hi Guys,
I need to know how to check whether my form is Active or Inactive, I mean whether my form's Window is Currently the Active Window or Inactive Window. Please Help me :(
Use GetForeGroundWindow API.
VB Code:
Private Declare Function GetForegroundWindow Lib "user32" () As Long Private Sub Timer1_Timer() If GetForegroundWindow = MyForm.hWnd Then 'your form is active Else 'your form is not active End If End Sub
You can either subclass it or set a local hook to track the activation of your window. If you need an example, I can try to post one for you.
Joe