|
-
Oct 9th, 2001, 04:47 AM
#1
Thread Starter
New Member
Q: API Setparent -> GPF
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
-
Oct 9th, 2001, 05:13 AM
#2
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
-
Oct 9th, 2001, 05:25 AM
#3
Thread Starter
New Member
It worked!
Thank you very much, i worked!
JLP
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
|