I need to obtain the handle of the window for SDL 2.0.3. I got the suggestion to use info.window after initializing SDL and filling the info variable with data by calling SDL_GetWindowWMInfo(); included in the header file SDL_syswm.h. My compiler (Visual Studio 2008) gives the following error:

226) : error C2039: 'window' : is not a member of 'SDL_SysWMinfo' 1> include\sdl_syswm.h(173) : see declaration of 'SDL_SysWMinfo'

  • 1
    \$\begingroup\$ Yep, that's what I was going to say. According to the documentation it is info.win.window. \$\endgroup\$ – glampert Aug 18 '14 at 2:19
  • 1
    \$\begingroup\$ Feel free to add a proper answer (either of you) and mark it as the correct answer \$\endgroup\$ – CobaltHex Aug 18 '14 at 2:29

Getting the window handle from an SDL window is pretty straightforward:

SDL_SysWMinfo systemInfo; 
SDL_GetWindowWMInfo(window, &systemInfo);

HWND handle = systemInfo.info.win.window;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.