Hello all
I have an application in wich I use the API SetParent. I works fine, but when i close the VB application, VB crashes!
Why...?
Info: VB 6.0 EE. SP5, Win 2000 Prof. SP2
Kind Regards
Jacob Laue Petersen
Printable View
Hello all
I have an application in wich I use the API SetParent. I works fine, but when i close the VB application, VB crashes!
Why...?
Info: VB 6.0 EE. SP5, Win 2000 Prof. SP2
Kind Regards
Jacob Laue Petersen
Where hWnd is the window handle of the created child -- do this in your form unload event. That's the one called when your program exits.
Code:
Private Declare Function DestroyWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function TerminateProcess Lib "kernel32" (ByVal hProcess As Long, ByVal uExitCode As Long) As Long
Private Declare Function GetCurrentProcess Lib "kernel32" () As Long
Private hWnd as Long
Private Sub Form_Unload(Cancel As Integer)
DestroyWindow hWnd
' the last line is not required
TerminateProcess GetCurrentProcess, 0
End Sub
Thank you very much, i worked!
JLP