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 


[HELP] Defining strings in assembly

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

Joined: 27 Oct 2015
Posts: 59

PostPosted: Thu Jun 10, 2021 10:55 pm    Post subject: [HELP] Defining strings in assembly Reply with quote

I'm trying to call FindWindow winapi in a lua script using assembly but I don't know how to define a string for the window name or if its possible to get a window and focus it using lua.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Fri Jun 11, 2021 12:43 am    Post subject: Reply with quote

CE exposes FindWindow as a normal call.
Code:
local hWnd = FindWindow(nil, 'Atomos');


No real need to call it with asm.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
ZxPwds
Advanced Cheater
Reputation: 0

Joined: 27 Oct 2015
Posts: 59

PostPosted: Fri Jun 11, 2021 3:26 pm    Post subject: Reply with quote

Are you please able to explain to me how you focus the window in Lua after you get the hwnd

Please and thank you
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Fri Jun 11, 2021 9:40 pm    Post subject: Reply with quote

There are a handful of API that can be used / may be required to be used to do this. You can use CE's 'executeCodeEx' function to call them.

A list of Window related API can be found here:
https://docs.microsoft.com/en-us/windows/win32/winmsg/windows

Some of them that would be of interest to look into:
- AttachThreadInput
- BringWindowToTop
- SetFocus
- SetForegroundWindow
- SetWindowPos
- ShowWindow
- SwitchToThisWindow

Not all of them need to be called, some may be required depending on the window/target, etc. You'll have to play around with them to see which the application will respond properly to and allow. Depending on how the application handles input, additional calls may be required.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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