Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28456 Discussions

OPENGL Window in Quickwin - window order problem

andrew_4619
Honored Contributor II
562 Views

I have created an opengl window from within a quickwin apllication. I have some other quickwin child windows and some modeless doalog boxes (tool boxes) open that can manipulate the content of the 3D graphic, I also have dynamic zoom/pan/spin of the OGL 3D scene with the mouse...

A problem I have is that anytime I click a quickwin dialog/child window/frame window the OGL window disappears into the backround i.e. behind the application frame window. I really need it on top of the frame window but could be fully or partly obsured by the quickwin childen of the frame window.

The creation code for the OGL window is show below (based on IFORT rings sample program), any ideas what I could try?

[fortran]if (hInstance == NULL0) then

hInstance = GetModuleHandle(NULL0)
wc%cbSize = sizeof(wc)
wc%style = CS_OWNDC
wc%lpfnWndProc = loc(WindowProc)
wc%cbClsExtra = 0
wc%cbWndExtra = 0
wc%hInstance = hInstance
wc%hIcon = LoadIcon(0_HANDLE, int(IDI_WINLOGO,LPVOID))
wc%hCursor = LoadCursor(0_HANDLE, int(IDC_ARROW,LPVOID))
wc%hbrBackground = (COLOR_WINDOW + 1) !NULL
wc%lpszMenuName = NULL0
wc%lpszClassName = loc(szClassName)
wc%hIconSm = NULL0
class_atom = RegisterClassEx(wc)
if (class_atom == 0) then
ret = MessageBox(NULL0, "RegisterClass() failed: Cannot register window class."C, "Error"C, MB_OK)
hWnd = NULL0
return
end if
end if
! Create the window
lcl_title = trim(title) // CHAR(0)
wflags=ior(WS_OVERLAPPEDWINDOW,WS_CLIPSIBLINGS)
wflags=ior(wflags,WS_CLIPCHILDREN)
!wflags=ior(wflags,WS_CHILD) not possible
hWnd = CreateWindowEx(0,szClassName, lcl_title, wflags, x, y, width, height, NULL0, NULL0, hInstance, NULL0)
if (hWnd == NULL0) then
ret = GetLastError()
ret = MessageBox(NULL0, "CreateWindow() failed: Cannot create a window."C, "Error"C, MB_OK);
return
end if[/fortran]

0 Kudos
4 Replies
onkelhotte
New Contributor II
562 Views

Maybe the focussqq function will do what you need...

Markus

0 Kudos
andrew_4619
Honored Contributor II
562 Views

I already but an API setfocus in the repaint routine. It does help but you click a dialog option and the graphics window hides, you click the redraw button I added and it appears again....  You can also arrange the screen(s) so the frames and graphics windows do not overlap, the problem is that it is a 'child' window of the application but is not in the window hirearchay of the apllication frame window. i think becase the OGL window needs a different context..... :-(

Still looking for a way to fix it properly

0 Kudos
Anthony_Richards
New Contributor I
562 Views

Have you tried adding WS_EX_TOPMOST style to your window?

WS_EX_TOPMOST Specifies that a window created with this style should be placed above all non-topmost windows and should stay above them, even when the window is deactivated. To add or remove this style, use the SetWindowPos function.

0 Kudos
andrew_4619
Honored Contributor II
562 Views

Thanks Anthony that is indeed what I was looking for. I already use Setwindowpos for x,y position but I hadn't realised you can set the z order by flag or relative to another window using an optional parameter. It works perfectly now.

0 Kudos
Reply