I have a set of MDI Child forms that open maxamized inside a MDI form. On the MID form there is a toolbar that says “close” form. I want to be able to click this button on the MDI form and close the open active form (MDI form on top of the other MDI forms with the focus or active). Am not sure how to reference.
I tried to do this with out success
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Dim frm As Form
Dim blnFormOpen
Dim nexts As Long
Const GW_CHILD = 5
'assume form not open
blnFormOpen = False
For Each frm In Forms
' exclude MDIForm
If Not TypeOf frm Is MDIForm Then
' only looking at MDIChild forms
nexts = GetWindow(frm.hwnd, 5)
‘ Am lost about here
'If nexts = Then
MsgBox "top" & frm.Name
End If
End If
Next
Any thoughts or comments would be appreciated thanks
Todd
I tried to do this with out success
Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Dim frm As Form
Dim blnFormOpen
Dim nexts As Long
Const GW_CHILD = 5
'assume form not open
blnFormOpen = False
For Each frm In Forms
' exclude MDIForm
If Not TypeOf frm Is MDIForm Then
' only looking at MDIChild forms
nexts = GetWindow(frm.hwnd, 5)
‘ Am lost about here
'If nexts = Then
MsgBox "top" & frm.Name
End If
End If
Next
Any thoughts or comments would be appreciated thanks
Todd