How to use SDL_GetWindowWMInfo to get access to the HWND?

I’d like to get a HWND reference to the SDL Window when running under Windows, so I can put a menu bar in it.

http://wiki.libsdl.org/moin.cgi/SDL_SysWMinfo?highlight=(\bCategoryStruct\b)|(CategorySWM)|(SGStructures)

I’m using the sample code here:

http://wiki.libsdl.org/moin.cgi/SDL_GetWindowWMInfo

But I get a compile error “error C2039: ‘win’ : is not a member of ‘SDL_SysWMinfo’”

Any ideas what I’m doing wrong? Yes, this is when compiling on Windows.

Code:

#include “SDL_syswm.h”

void initMMMenuBar(void )
{
SDL_SysWMinfo windowInfo;

SDL_VERSION(&windowInfo.version);
SDL_GetWindowWMInfo( gSpriteWorldP->mainWindow, &windowInfo );

… // unrelevantcode to create menu bar goes here…

SetMenu(windowInfo.win.window, hMenu); // COMPILE ERROR HERE: no win.window field

The documentation you used is intended for SDL 1.3, but the structure shown in the wiki is out of date even for that version - currently you get access to that property by using: windowInfo.info.win.window

If you are working with SDL 1.3, I recommend you to keep a copy of its source code handy to look up things that might have changed since the wiki pages were written.