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 


How to catch the loss of focus of the game window

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Tue Mar 16, 2021 2:46 am    Post subject: How to catch the loss of focus of the game window Reply with quote

Many games such as Fallout 4 have a handler that monitors when the user switches a task and pauses the game. Any ideas how to find this handler?
Back to top
View user's profile Send private message
sbryzl
Master Cheater
Reputation: 6

Joined: 25 Jul 2016
Posts: 252

PostPosted: Tue Mar 16, 2021 2:48 pm    Post subject: Reply with quote

Find what the window handle is (hwnd). All programs including games have many ops and variables that track the hwnd. For instance it might call GetWindowInfo which requires the hwnd.
Once you know the handle, search for it in memory and find what accesses it when the window is active and inactive and it should become apparent how to distinguish them.
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Mar 16, 2021 3:15 pm    Post subject: Re: How to catch the loss of focus of the game window Reply with quote

Any specific reason?
You could hook wndproc if you are doing something externally.

Otherwise you could just check if there anything that is being toggled(1 or 0) whenever window get deactivated/activated.
Attach to game, set in cheatengine hotkeys, pause/unpack hotkey.
Go to game, press hotkey (to pause), go back to ce, scan 1, un-pause game, scan 0 and repeat...

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Mar 16, 2021 3:34 pm    Post subject: Reply with quote

This is generally done in the games WNDPROC. You can breakpoint on things like:
- DefWindowProcA / DefWindowProcW
- CallWindowProcA / CallWindowProcW

And trace back from there. Generally, this will probably be handled via the WM_ACTIVATE message or the WM_KILLFOCUS/WM_SETFOCUS messages.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Ultraplayer
Newbie cheater
Reputation: 0

Joined: 06 Apr 2019
Posts: 20

PostPosted: Tue Mar 16, 2021 4:08 pm    Post subject: Re: How to catch the loss of focus of the game window Reply with quote

DaSpamer wrote:
Any specific reason?

Just for convenience. Thanks for the advice

atom0s wrote:
This is generally done in the games WNDPROC...

Thanks for the advice
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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