Click to See Complete Forum and Search --> : Getting the windowstate
DragonSteve
Nov 21st, 2000, 04:29 AM
Is there API call for retrieving the state of a window(maximized,minimized) and how can I restore it to his
original size.
THANKS
crispin
Nov 21st, 2000, 06:14 AM
Forms have a WindowState Property, I don't think you'll need to use the API for this one, heres a bit of demo code:
Private Sub Form_Resize()
If Form1.WindowState = vbMinimized Then
MsgBox "Hello"
Form1.WindowState = vbNormal
End If
End Sub
[Edited by crispin on 11-21-2000 at 07:17 AM]
DragonSteve
Nov 21st, 2000, 06:21 AM
Thanks for the reply but I ask for this because I calling an activeX DLL that has a form within. I am calling this AXDLL troughout a shell I've build. Now, I want to be able to determin if the AXDLL I've called is minimized by the user or not.(this to maximize it if the user click's again on the button to call the AXDLL.
Thanks.
alex_read
Nov 21st, 2000, 09:07 AM
Ok, click on this link:
http://www.incognitasoftware.com/vbcomp.htm
and look at the NuAPIView 2.0 file. This is a custom api viewer that has updated dll links and is probably 10,000 times better than the MS one.
Download this, and the help file and lookup the "windowplacement" type declaration APIcall in the help file ;)
Use the IsIconic and IsZoomed API functions.
Private Declare Function IsIconic Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Sub Command1_Click()
Dim hApp As Long
hApp = FindWindowEx(0, 0, "Notepad", vbNullString)
If IsIconic(hApp) Then MsgBox "It's minimized"
If IsZoomed(hApp) Then MsgBox "It's maximized"
End Sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.