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.
Posted: Tue Mar 16, 2021 3:15 pm Post subject: Re: How to catch the loss of focus of the game window
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... _________________
I'm rusty and getting older, help me re-learn lua.
Joined: 25 Jan 2006 Posts: 8586 Location: 127.0.0.1
Posted: Tue Mar 16, 2021 3:34 pm Post subject:
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. _________________
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