I would like to get the handle of a SDL2 window, to use it with WinApi.
I retrieve that handle with the following code :
/* All the SDL initalisation... */
SDL_Window* window = SDL_CreateWindow("My Window", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, RESX, RESY, SDL_WINDOW_SHOWN);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (window == NULL || renderer == NULL) {
MessageBox(NULL, L"SDL initialisation error", NULL, MB_OK);
exit(-1);
}
SDL_SysWMinfo wmInfo;
SDL_GetWindowWMInfo(window, &wmInfo);
HWND hwnd = wmInfo.info.win.window;
But at this point, hwnd
adress is 0xcccccccc
(unused).
Did I do something wrong?