|
-
May 9th, 2001, 01:46 PM
#1
Thread Starter
Addicted Member
unloading child with parent
I have set my vb program to be a child of an off-the shelf contact management program called GoldMine. When I close the parent, my program seems to go away but it is actually still running and I can see it in task manager. How can I tell my program to end with the parent without being able to change the programming of the parent itself?
-
May 9th, 2001, 03:50 PM
#2
You could use FindWindowEx to search for the parent window, and if it's not found, then send the WM_QUIT message (via PostQuitMessage) to your App.
-
May 10th, 2001, 09:16 AM
#3
Thread Starter
Addicted Member
-
May 10th, 2001, 04:35 PM
#4
Code:
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Priavte Sub Timer1_Timer
hApp = FindWindowEx(0, 0, "ClassName", "Title")
If hApp = 0 Then PostQuitMessage(0)
End Sub
Careful not to do this in the IDE, however, because it will end VB as well.
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
|