Results 1 to 7 of 7

Thread: [RESOLVED] find app.exe in the list of procces

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Posts
    256

    Resolved [RESOLVED] find app.exe in the list of procces

    hi,

    i'd like to do this thing in my app:

    i want to have a class, a module, that: when the program app.exe be closed, it shows the msgbox program was closed!

    how can i do that?

  2. #2

  3. #3
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: find app.exe in the list of procces

    I think the OP wants to monitor an external Exe and be notified when it has exited/closed? If thats the case search the forum, there are many examples already posted, , heres another one...
    Attached Files Attached Files

  4. #4
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: find app.exe in the list of procces

    The attached snippet is originally form Penagate but I modified it a bit since the determination of the target application's closing is not handled correctly. This is without using a timer.
    Attached Files Attached Files
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Posts
    256

    Re: find app.exe in the list of procces

    its like a launcher, that prevents ant-hack actions. and, when the process of the its over, i want that to appears a msgbox informing that the process is over. i'll see the codes that you posted here. thanks

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2008
    Posts
    256

    Re: find app.exe in the list of procces

    edgemetal

    thanks, your example works, thanks

  7. #7
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: find app.exe in the list of procces

    Quote Originally Posted by lelejau
    edgemetal

    thanks, your example works, thanks
    If you are checking for the EXE very often, like once per second or less, you could make the routine slightly more efficient by saving and comparing just the process ID for the exe once its found.

    Add to declares...
    Code:
    Private ExePID As Long
    Add to the end of Sub WatchOff...
    Code:
    ExePID = 0
    Update the Function CheckForExe...
    Code:
        For L = 0 To cbNeeded / 4
            If ExePID = 0 Then
                ' Find matching filename and save its Process ID if found
                If ProcessIDs(L) > 0 Then sTitle = CutPath(GetExePathFromPID(ProcessIDs(L)))
                If LCase$(sTitle) = LCase$(ExeFile) Then
                    CheckForExe = True
                    ExePID = ProcessIDs(L)
                   Exit For
                End If
            Else ' we already know the PID of the exe so just check for matching PID.
                If ExePID = ProcessIDs(L) Then
                    CheckForExe = True
                    Exit For
                End If
            End If
        Next L

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