mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Refactor dx device creation
Find the game's window instead of using the foreground window.
This commit is contained in:
parent
dc7480c633
commit
5a0653d080
7 changed files with 71 additions and 12 deletions
|
|
@ -7,6 +7,26 @@ extern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam
|
|||
|
||||
#include "../dll/dll.h"
|
||||
|
||||
HWND GetGameWindow()
|
||||
{
|
||||
HWND hWnd = FindWindow(NULL, NULL);
|
||||
while (hWnd)
|
||||
{
|
||||
if (!GetParent(hWnd))
|
||||
{
|
||||
#if defined(_WIN64)
|
||||
if (GetModuleHandle(NULL) == (HINSTANCE)GetWindowLong(hWnd, GWLP_HINSTANCE))
|
||||
break;
|
||||
#elif defined(_WIN32)
|
||||
if (GetModuleHandle(NULL) == (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE))
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
hWnd = GetWindow(hWnd, GW_HWNDNEXT);
|
||||
}
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
bool Windows_Hook::start_hook()
|
||||
{
|
||||
if (!_hooked)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue