Getting the handle of the Irrlicht Window

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Jallenbah
Posts: 12
Joined: Thu Aug 14, 2008 12:10 pm
Location: Vector3df(20.6, 4, 19.2);

Getting the handle of the Irrlicht Window

Post by Jallenbah »

Hi.
I'm programming using Windows, and in order to use the Input system I want to, as well as some other performance optimisations I feel need adding, I need to get a handle to the window created by Irrlicht.

I created it like:

Code: Select all

device = irr::createDevice(driver_type, irr::core::dimension2d<irr::s32>(SCREEN_X, SCREEN_Y), 
		COLOUR_BITS, FULLSCREEN, false, VSYNC, &eventReceiver);
So, is there some function i can call to obtain it? Because right now i'm having difficulty getting it.
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Getting the handle of the Irrlicht Window

Post by randomMesh »

First set the name of the window like this

Code: Select all

device->setWindowCaption(L"yourname");
then get the handle like this

Code: Select all

HWND irrlichtWindow = FindWindow(NULL, "yourname");
Untested, but should work.
Jallenbah
Posts: 12
Joined: Thu Aug 14, 2008 12:10 pm
Location: Vector3df(20.6, 4, 19.2);

Post by Jallenbah »

Ah, that looks about right. I'll try it now and post the result.
pc0de
Posts: 300
Joined: Wed Dec 05, 2007 4:41 pm

Post by pc0de »

Also:

Code: Select all

HWND irrlichtWindow = device->getVideoDriver()->getExposedVideoData().OpenGLWin32.HWnd;
Works for both DirectX and OGL.
Jallenbah
Posts: 12
Joined: Thu Aug 14, 2008 12:10 pm
Location: Vector3df(20.6, 4, 19.2);

Post by Jallenbah »

I can confirm that the FindWindow() method works fine.

I also added a random amount of invisible characters like spaces to the window name so that collisions were unlikely, though it would be unlikely anyway.

That Method just mentioned looks like it would work too, but if it ain't broke, don't fix it! :P

Thanks
Post Reply