Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


i need function please to get window game title

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
gavrielsinvani
Cheater
Reputation: 0

Joined: 29 May 2019
Posts: 36

PostPosted: Mon Jun 10, 2019 2:33 pm    Post subject: i need function please to get window game title Reply with quote

i need function please to get window game title

GetWindowGameTitle(PID) , and its return Title Name Window...

please help me =[
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Tue Jun 11, 2019 6:49 am    Post subject: Reply with quote

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))

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites