Is there a way to Maximize a 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
Mloren
Posts: 114
Joined: Mon Aug 07, 2006 2:30 am
Location: Australia
Contact:

Is there a way to Maximize a window?

Post by Mloren »

I have created the device and used setResizeAble(true) so it has the maximize and minimize buttons in the top right corner.
What I want to know is, is there a way to have the screen start off maximized? I couldnt find any SetMaximize() type functions...
funjobie
Posts: 5
Joined: Tue Mar 08, 2005 5:16 am

Post by funjobie »

sry for reviving this, but is there an answer to this yet?
I'd like to start my window-based editor maximized...
linkoraclehero
Posts: 81
Joined: Sat Sep 09, 2006 6:46 am

Post by linkoraclehero »

Your going to have to use Windows API for this. Pretty simple stuff though. Seeing as most people don't do it liek they should, I'll break it down for you:

First, include windows.h:

Code: Select all

#include <windows.h>
Second, you need to get the HWND (The window in which Irrlicht draws). This is assuming your video driver's pointer is named video:

Code: Select all

For DirectX 9:
HWND h = reinterpret_cast<HWND>(video->getExposedVideoData().D3D9.HWnd);

For DirectX 8:
HWND h = reinterpret_cast<HWND>(video->getExposedVideoData().D3D8.HWnd);

For OpenGL:
HWND h = reinterpret_cast<HWND>(video->getExposedVideoData().OpenGLWin32.HWnd);
Third, you'll need to call ShowWindow on the HWND.

Code: Select all

ShowWindow(h,SW_SHOW | SW_MAXIMIZE);
And presto, the window should maximize once ShowWindow is called. I haven't tested this, just seems like it'll work :]. I haven't used Windows API in awhile, since I started using Irrlichts built-in GUI.
funjobie
Posts: 5
Joined: Tue Mar 08, 2005 5:16 am

Post by funjobie »

thanks, it did work nearly as you posted.( I had the windows api included anyway)
I'm using OpenGL. with the code you posted, the device prints:
Ignoring resize Operation to (0,0)
and minimizes the window.
but if I use

Code: Select all

ShowWindow(h,SW_MAXIMIZE);
it works just fine :D
Post Reply