|
-
Jul 12th, 2001, 11:47 AM
#1
Thread Starter
Member
Unloading forms using hWnd
Is it possible to unload a form using its handle? That is to say, is there an equivalent WinAPI call to VB's UNLOAD method/statement? I have already tried DestroyWindow, and when I go to load the form for reuse in my program, VB gives me an 'Invalid call or procedure' error.
-
Jul 12th, 2001, 04:08 PM
#2
Fanatic Member
This code will minimise the window. May be not what you want?
Code:
Option Explicit
Private Declare Function CloseWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub Form_Load()
CloseWindow Me.hwnd
End Sub
-
Jul 12th, 2001, 06:58 PM
#3
Frenzied Member
CloseWindow
The CloseWindow function minimizes (but does not destroy) the specified window.
BOOL CloseWindow(
HWND hWnd // handle to window to minimize
);
Parameters
hWnd
Handle to the window to be minimized.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
The window is minimized by reducing it to the size of an icon and moving the window to the icon area of the screen. The system displays the window's icon instead of the window and draws the window's title below the icon.
To destroy a window, an application must use the DestroyWindow function.
So use the DestroyWindow API
-
Jul 12th, 2001, 06:59 PM
#4
Frenzied Member
I almost forgot the declaration
VB Code:
Declare Function DestroyWindow Lib "user32" Alias "DestroyWindow" (ByVal hwnd As Long) As Long
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|