
Although Visual Basic 3.0 gives you a fit if you try to hide an MDI child form by setting its visible property to false there's no need to give up hope just yet! Try this little Windows API trick to get the job done!
You will need to declare the API function as in the line below:
For VB3/VB4-16:
Declare Function ShowWindow% Lib "User" (ByVal hWnd%, ByVal nCmdShow%)
For VB4-32/VB5:
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Then, to call the function, use a statement like the one that follows:
X% = ShowWindow(frmID.hWnd, 0) ' Where frmID is the name property of the MDI child form you want to hide.The ShowWindow function will return TRUE (a non-zero value) if the form was not already hidden. Otherwise, it will return FALSE (0).
This routine will work on forms other than MDI child forms as well. You only need to know the handle of the window you want to make invisible. Check out the ShowWindow function because it can do a whole lot more than just hide forms!