what window
Printable View
what window
Put the following in a Form with a Timer
Code:Private Sub Form_Load()
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If Me.WindowState = 2 Then 'It's Maximized
If Me.WindowState = 1 Then 'It's Minimized
If Me.WindowState = 0 Then 'It's Normal
End Sub
That would work great if was in the same form or project. My program is changing the resolution of the monitor, then running an exe through shell. I need to keep track of the window the exe is running in so if the user minimize the exe window the resolution would change back to the orginal settings.
Hi,
u can use the getWindowLong API.
look up:
http://209.207.250.135/ref/g/getwindowlong.html
and also:
http://209.207.250.135/ref/other/windowstyles.html
paste this code into a form named form1. It will tell u if the form is maximised or not. To find out if any other window is maximised or not, replace Form1.hwnd with the handle of that window.
Hope this helps.
Code:Const WS_MAXIMIZE = &H1000000
Const GWL_STYLE = -16
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Sub Command1_Click()
Dim Retval As Long
Dim res
Retval = GetWindowLong(Form1.hwnd, GWL_STYLE)
If (Retval And WS_MAXIMIZE) = WS_MAXIMIZE Then
Debug.Print "Form1 is maximized."
Else
Debug.Print "Form1 is not maximized."
End If
End Sub