Mar 17th, 2009, 11:43 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Detect a process and timer
what i want to do is like xfire when you open xfire and go on a game it detects the games process and counts.
i need my program to detect alefclient.exe and when its started, i need it to start a timer to count the time i've played on it, so the timer will count up on label1 and the label1 must have the format (days, hours, mins, sec).
what i need is it to detect alefclient.exe and when it is detected, start timer then view the time in the format days, hours, mins, secs on a label.
Last edited by Justa Lol; Mar 17th, 2009 at 11:47 AM .
Mar 17th, 2009, 02:13 PM
#2
Re: Detect a process and timer
Instead of depending on a timer to keep track of the run time it might be better to do it like this,
Get PID of the exe.
Get start time/date of PID.
In a timer call an elapsed time function to return the start time/date compared to current time/date.
At least thats how I've done it for a couple of my apps.....
Last edited by Edgemeal; Apr 25th, 2009 at 02:02 AM .
Mar 17th, 2009, 06:03 PM
#3
Thread Starter
Fanatic Member
Re: Detect a process and timer
exactly how i want it...
can you give me an example code?
Last edited by Justa Lol; Mar 17th, 2009 at 06:25 PM .
Mar 17th, 2009, 07:32 PM
#4
Re: Detect a process and timer
Originally Posted by
Justa Lol
can you give me an example code?
See if this helps,
Attached Files
Mar 17th, 2009, 08:03 PM
#5
Thread Starter
Fanatic Member
Re: Detect a process and timer
works but one problem....
Last edited by Justa Lol; Oct 30th, 2011 at 03:59 AM .
Mar 17th, 2009, 10:49 PM
#6
Thread Starter
Fanatic Member
Re: Detect a process and timer
i found out another way but now i want my label to show the time it has run...
Day - hour:min:sec is the format i want to use. and i have no start date i just have a timer to make the label count 1 up every sec.
Mar 18th, 2009, 08:50 AM
#7
Re: Detect a process and timer
works but one problem....
Not sure why unless it's a hidden exe, If you are using Shell to start the Exe might want to try using the returned value for the PID. PID=SHELL(....
i have no start date i just have a timer to make the label count 1 up every sec.
Just use the ElapsedTime module and manually set the start time,
Code:
'start/reset
StartDate = Now
Label1 = StartDate
Label2 = "00:00:00:00"
Timer1.Enabled = True' timer set to 1000ms
Mar 18th, 2009, 12:21 PM
#8
Thread Starter
Fanatic Member
Re: Detect a process and timer
i got everything working... but my process is messed up.
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