Results 1 to 12 of 12

Thread: [2008] Constantly look for running process

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    6

    [2008] Constantly look for running process

    Hello forums!

    I'm in need of some assistance.
    I'm creating a project that looks for a particular process "Engine.exe".

    If the process is running, it moves certain files.
    So, I'm looking for help generating a script that constantly looks for this process.

    I ran into this script:
    Code:
    For Each myprocess In Process.GetProcesses
                If myprocess.MainWindowTitle.Contains("Engine") Then
    'what you want here
    
                End If
    
            Next
    It isn't really what I was looking for.
    So if any of you can help me with this.

    It would be GREATLY appreciated.



    P.S I'm also looking to know how to do this:
    Let's say I put the .exe of my program into a certain folder.
    I then use the 'Application.StartupPath' code to find where it is.

    But how would I use this to move certain files in this folder?
    I can't use a simple move command because the path varies.

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

    Re: [2008] Constantly look for running process

    When you say 'constantly look' what exactly did you mean by that? Do you want to monitor if it is running or not?
    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

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    6

    Re: [2008] Constantly look for running process

    Quote Originally Posted by dee-u
    When you say 'constantly look' what exactly did you mean by that? Do you want to monitor if it is running or not?
    Yes.
    Instead of just on start up.

    They will open up the program.
    They will start engine.exe.

    The program will automatically detect engine.exe running, and move certain files.

    When finished, they close engine.exe.
    The program automatically detects engine.exe is no longer running, and moves the certain files back to their original destination.

    Is what I'm hoping to accomplish.

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

    Re: [2008] Constantly look for running process

    You can use WMI for that. Have a look at this and this.
    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
    New Member
    Join Date
    Jan 2009
    Posts
    6

    Re: [2008] Constantly look for running process

    Quote Originally Posted by dee-u
    You can use WMI for that. Have a look at this and this.
    It's saying I must be a subscribed member to view the solution.
    Last edited by JasonMarquee; Jan 4th, 2009 at 02:52 AM.

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

    Re: [2008] Constantly look for running process

    Did you look at the bottom part? I can see the codes even while I am not a member in that site.
    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

  7. #7

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    6

    Re: [2008] Constantly look for running process

    Quote Originally Posted by dee-u
    Did you look at the bottom part? I can see the codes even while I am not a member in that site.
    Didn't notice that part.
    Well, it's a HUGE code.

    Mind helping me out with it?
    I'm fairly new to all of this.

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

    Re: [2008] Constantly look for running process

    You can try it out as posted there so would have a taste of it, if you run into problems then you can get back here and post it.
    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

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    6

    Re: [2008] Constantly look for running process

    Error 1 Type 'System.Management.EventArrivedEventArgs' is not defined.r

    Error 2 Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

    Error 3 Type 'PropertyData' is not defined. C

    Error 4
    Type 'ManagementBaseObject' is not defined.

    Error 5
    'ProcessCreated' is not an event of 'www.MPGH.net.Form1'.

    Error 6
    Statement cannot appear within a method body. End of method assumed.

  10. #10

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    6

    Re: [2008] Constantly look for running process

    Don't mean to double post, but it's important that I get what I'm looking for.

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

    Re: [2008] Constantly look for running process

    Did you follow this advice from that thread?

    ' Add a reference to System.Management.dll.
    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

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

    Re: [2008] Constantly look for running process

    You may also want to have a look at this MSDN article.

    http://msdn.microsoft.com/en-us/libr...ntwatcher.aspx
    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

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