FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Tue Jun 11, 2019 6:49 am Post subject: |
|
|
from celua.txt | Code: | getOpenedProcessID() : Returns the currently opened process. If none is open, returns 0
getProcessIDFromProcessName(name) : returns a processid
...
getForegroundProcess() : Returns the processID of the process that is currently on top
findWindow(classname OPTIONAL, caption OPTIONAL): windowhandle - Finds a window with the given classname and/or windowname
getWindow(windowhandle, command) : windowhandle - Gets a specific window based on the given window (Check MSDN getWindow for the command description)
getWindowCaption(windowhandle) : string - Returns the caption of the window
getWindowClassName(windowhandle): string - Returns the classname of the window
getWindowProcessID(windowhandle): processid - Returns the processid of the process this window belongs to
getForegroundWindow() - windowhandle : Returns the windowhandle of the topmost window
|
so something like
| Code: |
gameHWND = nil
-- save in case someone else is using this too
old = MainForm.OnProcessOpened
-- note that if the caption never changes for your game you can
-- ignore basically all the code inside here and just do whatever
-- with the caption given in the arguments, but window titles
-- do sometimes change so I show how to get a window handle
-- and then you can constantly check/update the caption later
-- when a process is opened by CE
MainForm.OnProcessOpened = function(pid, processhandle, caption)
-- call the previous handler if there is one
if old then old(pid, processhandle, caption) end
-- get window handle from foreground window, when we know game _is_ in foreground
local t = createTimer()
t.Interval = 10
t.OnTimer = function(t)
if getForegroundProcess() == pid then -- if game on top
gameHWND = getForegroundWindow() -- get the window handle
t.destroy() -- stop now that we have the handle
end
end
end
-- ... later
print(getWindowCaption(gameHWND)) |
_________________
|
|