Hi,

Guys, I got the solution.
Thanks a lot for all your help!

The code is right now like this:

Code:

void init_viewer(osgViewer::Viewer* Viewer, int x, int y, int width, int height)
{
        scene = osgDB::readNodeFile("d:/OpenSceneGraph-Data/cessna.osg");

        Viewer->setSceneData(scene);
        Viewer->setUpViewInWindow(x, y, width, height);
        Viewer->addEventHandler(new KeyboardEventHandler());

        //get window handle to remove the borders and later on for minimizim 
and restoring the OSG-window.
        gw = dynamic_cast<osgViewer::GraphicsWindowWin32*> 
(viewer->getCamera()->getGraphicsContext());
        //this is the window handle
        hWnd = gw->getHWND();   

        //remove the buttons (minimize, restore and close)
        LONG lStyle = GetWindowLong(hWnd, GWL_STYLE);   
        lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | 
WS_SYSMENU);
        SetWindowLong(hWnd, GWL_STYLE, lStyle);

        //remove the window borders
        LONG lExStyle = GetWindowLong(hWnd, GWL_EXSTYLE); 
        lExStyle &= ~(WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE | 
WS_EX_STATICEDGE);
        SetWindowLong(hWnd, GWL_EXSTYLE, lExStyle);     
}


void makeViewerVisible()
{
        ShowWindow(hWnd, SW_RESTORE);
}

void makeViewerInvisible()
{
        ShowWindow(hWnd, SW_MINIMIZE);
}





This works exactly how I wanted.
Instead of trying it from the OSG side, I let the window handle take care of 
removing the borders and hide/show the window.
The only thing that was needed is to get the windows handle from OSG. Then let 
windows do the "magic".

Thanks you again!

Cheers,
Marco[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=59636#59636





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to