|
-
Jan 4th, 2009, 01:52 AM
#1
Thread Starter
New Member
[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.
-
Jan 4th, 2009, 02:12 AM
#2
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?
-
Jan 4th, 2009, 02:28 AM
#3
Thread Starter
New Member
Re: [2008] Constantly look for running process
 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.
-
Jan 4th, 2009, 02:39 AM
#4
Re: [2008] Constantly look for running process
You can use WMI for that. Have a look at this and this.
-
Jan 4th, 2009, 02:43 AM
#5
Thread Starter
New Member
Re: [2008] Constantly look for running process
 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.
-
Jan 4th, 2009, 02:48 AM
#6
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.
-
Jan 4th, 2009, 02:51 AM
#7
Thread Starter
New Member
Re: [2008] Constantly look for running process
 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.
-
Jan 4th, 2009, 02:56 AM
#8
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.
-
Jan 4th, 2009, 03:00 AM
#9
Thread Starter
New Member
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.
-
Jan 5th, 2009, 06:52 AM
#10
Thread Starter
New Member
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.
-
Jan 5th, 2009, 08:13 AM
#11
Re: [2008] Constantly look for running process
Did you follow this advice from that thread?
' Add a reference to System.Management.dll.
-
Jan 5th, 2009, 08:15 AM
#12
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
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
|