View previous topic :: View next topic |
Author |
Message |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Sat Apr 04, 2020 4:46 am Post subject: Detect when process closes |
|
|
Hey there, i just wondered is there any simple way to detect whenever a process is closed, and then automatically closeCE()?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25787 Location: The netherlands
|
Posted: Sat Apr 04, 2020 6:28 am Post subject: |
|
|
in a timer
Code: |
if readInteger(process)==nil then closeCE() end
|
of course only run the timer after opening a process
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
 |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Sat Apr 04, 2020 6:40 am Post subject: |
|
|
Dark Byte wrote: | in a timer
Code: |
if readInteger(process)==nil then closeCE() end
|
of course only run the timer after opening a process |
A timer is lagging the form, is there any other ways?
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Apr 04, 2020 6:58 am Post subject: |
|
|
Foxculated wrote: | Dark Byte wrote: | in a timer
Code: |
if readInteger(process)==nil then closeCE() end
|
of course only run the timer after opening a process |
A timer is lagging the form, is there any other ways? |
What interval are you using. 2000ms should be enough.
If you have animations (or other moving stuff) in the form and you do not like micro-freezes every 2000ms, you can use a thread.
_________________
|
|
Back to top |
|
 |
Foxculated Newbie cheater
Reputation: 0
Joined: 26 Mar 2020 Posts: 11
|
Posted: Sat Apr 04, 2020 7:31 am Post subject: |
|
|
[quote="Foxculated"] Dark Byte wrote: | in a timer
Code: |
if readInteger(process)==nil then closeCE() end
|
of course only run the timer after opening a process |
Im a bit newbie in cheat engine , so i will ask for help again, will the code look something like this?
EDIT: got it to work.
Code: |
if getProcessIDFromProcessName("cheatengine.exe") ~= nil then
object_destroy(timer)
readInteger(process)==nil then closeCE() end
|
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Apr 04, 2020 8:42 am Post subject: |
|
|
Foxculated wrote: | EDIT: got it to work.
Code: |
if getProcessIDFromProcessName("cheatengine.exe") ~= nil then
object_destroy(timer)
readInteger(process)==nil then closeCE() end
|
|
Do not know how this is working for you.
For automatic CE close when attached process no longer exists, you have to use timer or thread. here example with timer object:
Code: | function detectProcessClosedTimerFunc(timer)
local result = readInteger(process)
if result==nil then closeCE() end
end
--define OnProcessOpened function. It gets called after process is opened
MainForm.OnProcessOpened = function (processID,processhandle,processHexID_processName)
if detectProcessClosedTimer==nil then -- create only one timer object (just in case user opens process again)
detectProcessClosedTimer = createTimer(MainForm)
detectProcessClosedTimer.Interval = 500
detectProcessClosedTimer.OnTimer = detectProcessClosedTimerFunc
end
end |
_________________
|
|
Back to top |
|
 |
|