Getting HWND of Ogre Window


26-10-2009 19:55:32

I'm trying to find the HWND of a window created by Ogre through createRenderWindow. I found this thread which offers up the code (C++)HWND hwnd;
renderWindow->getCustomAttribute("HWND", &hwnd);

However attempts to get this working in python ogre have been completely unsuccessful thus far. The code I came up with was self.root.initialise(False)
misc = ogre.NameValuePairList()
misc['border'] = 'none'
self.root.createRenderWindow('WIP', SCREEN_WIDTH, SCREEN_HEIGHT, False, misc)
print self.renderWindow.getCustomAttributeUnsignedLong("HWND")
print self.renderWindow.getCustomAttributeInt("HWND")
print self.renderWindow.getCustomAttributeFloat("HWND")
#Always prints the following

Does anyone know how I can get the HWND value of an Ogre created window? I hope I'm not going to have to create the window through another means, so that I can pass the HWND to Ogre to render to, in order to then have a window which I know the HWND of.

Running python 2.5.4, python-ogre 1.6.1 r940 updated.


27-10-2009 08:35:45

Here they use:

windowHandle = renderWindow.getCustomAttributeInt("WINDOW")

Does this solve?


27-10-2009 20:25:04

That worked perfectly, thanks!