Minimize button

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
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Minimize button

Post by Catprog »

Is is possible to have a minimize button on the window?

Tried setResizeAble(true) but that gives me a maximize button which I do not want and a disabled minimize button.
jef
Posts: 18
Joined: Sat Nov 13, 2004 10:10 pm

Post by jef »

If you don't want to change the engine source I think you can do something like this...

Code: Select all

    IrrlichtDevice *device = createDevice( ...

    HWND hWnd = FindWindow( "CIrrDeviceWin32", 0 );
//  HWND hWnd = GetActiveWindow();
    if ( hWnd )
    {
        LONG style = GetWindowLong( hWnd, GWL_STYLE );
        style |= WS_MINIMIZEBOX;
        SetWindowLong( hWnd, GWL_STYLE, style );
        SendMessage( hWnd, WM_NCPAINT, 1, 0 ); 
    }
or if you are not using the software drivers...

Code: Select all

    video::IVideoDriver* driver = device->getVideoDriver();

    video::SExposedVideoData ed = driver->getExposedVideoData();
    HWND hWnd = 0;

    switch ( driver->getDriverType())
    {
    case video::EDT_DIRECT3D8:
        hWnd = reinterpret_cast<HWND>( ed.D3D8.HWnd );
        break;
    case video::EDT_DIRECT3D9:
        hWnd = reinterpret_cast<HWND>( ed.D3D9.HWnd );
        break;
    case video::EDT_OPENGL:
        hWnd = reinterpret_cast<HWND>( ed.OpenGLWin32.HWnd );
        break;
    default:
        break;
    }

    if ( hWnd )
    {
        LONG style = GetWindowLong( hWnd, GWL_STYLE );
        style |= WS_MINIMIZEBOX;
        SetWindowLong( hWnd, GWL_STYLE, style );
        SendMessage( hWnd, WM_NCPAINT, 1, 0 ); 
    }
// jef
Catprog
Posts: 164
Joined: Wed Jan 31, 2007 9:07 am
Contact:

Post by Catprog »

Thanks.

Now to find out how to do in Linux for cross-platform capability. (In the future )
Post Reply