Results 1 to 4 of 4

Thread: unloading child with parent

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    205

    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?

  2. #2
    Megatron
    Guest
    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    205
    How do I trigger that?

  4. #4
    Megatron
    Guest
    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
  •  



Click Here to Expand Forum to Full Width