diff --git a/include/SDL_syswm.h b/include/SDL_syswm.h index 71ba5f1f3..f8835f64f 100644 --- a/include/SDL_syswm.h +++ b/include/SDL_syswm.h @@ -201,6 +201,7 @@ struct SDL_SysWMinfo { HWND window; /**< The window handle */ HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index e079e292f..7776c4671 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -127,6 +127,7 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) data->window = window; data->hwnd = hwnd; data->hdc = GetDC(hwnd); + data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->mouse_button_flags = 0; data->videodata = videodata; @@ -706,6 +707,10 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.win.hdc = data->hdc; } + if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) { + info->info.win.hinstance = data->hinstance; + } + return SDL_TRUE; } else { SDL_SetError("Application not compiled with SDL %d.%d\n", diff --git a/src/video/windows/SDL_windowswindow.h b/src/video/windows/SDL_windowswindow.h index 7d50ba66e..b61bcb39b 100644 --- a/src/video/windows/SDL_windowswindow.h +++ b/src/video/windows/SDL_windowswindow.h @@ -33,6 +33,7 @@ typedef struct HWND hwnd; HDC hdc; HDC mdc; + HINSTANCE hinstance; HBITMAP hbm; WNDPROC wndproc; SDL_bool created;