Sign in to follow this  
spiralmonkey

Arrgh! Viewing a child window when in D3D fullscreen mode

Recommended Posts

Hi All, I'm having a frustrating problem. I have a virtual aquarium called Dream Aquarium that runs in double-buffered fullscreen D3D, and I'm having problems adding a file requester to it. I open a file requester with GetOpenFileName(&ofn) but it is only visible about HALF the times i attempt to open it (my graphics drawing stops when the function is called because it's all one thread). The other half of the time it seems the file requester window did not pop to the front or was drawn on top of. So i tried other things. I tried doing a ShowWindow(myD3Dwindow, SW_HIDE) to hide my D3D window, exposing the desktop to show the file requester... which again worked only HALF the time. The other half of the time I just had a frozen aquarium image while somewhere in the background the file requester waited. I can see my mouse cursor is responding to the file requester, but it's covered by the D3D image. I even tried calling SW_HIDE several times, with Sleep() functions in between. I've tried SW_MINIMIZE, with the same results. Everything I try only seems to stow the aquarium away randomly half the time. Does this have to do with double-buffering? I'm using Direct3D 8.1 on XP if that's any help. Any suggestions?? Would there be a proper method to adding a filerequester to this type of D3D window? (free aquarium for anyone who can help!) Thanks very much, Alan [Edited by - spiralmonkey on July 29, 2008 4:30:41 PM]

Share this post


Link to post
Share on other sites
When an application is running in full-screen exclusive mode, it will not play fair with conventional windows (hence the "exclusive" bit). Rather than using full-screen mode, it might be easier to render in windowed mode, but use a maximised, borderless window. This will fill the screen and also play fair with your file dialog.

Share this post


Link to post
Share on other sites
I could, but will that not affect my app's performance? I want to keep my wait for vsync and be able to run at the maximum refresh rate with as much efficiency as possible. Is there not a way to make sure my D3D window can be temporarily stowed away while a user uses the file requester? Or is there a way to make the file requester place nice as a child of the D3D window? Surely it's possible because half the time it does seem to work fine.

Share this post


Link to post
Share on other sites
Further investigation reveals that the filerequester works successfully after every 2nd pd3dDevice->Present() call. That's why it seems to be working randomly about half the time. After 1 present() it will fail to hide the window, but after the 2nd Present() it will work fine. Anyone have an idea why this might be?

Share this post


Link to post
Share on other sites
This page indicates that you should use IDirect3DDevice9::SetDialogBoxMode. I don't know if there's a DX 8.1 equivalent.

As for why this is needed, my rusty memory recalls that GDI only renders to one of the buffers, and thus if that buffer is not currently being presented (i.e. Present has flipped buffers), then GDI content (and therefore all standard Windows UI) is not visible. This explains why it's visible every other Present call, since that's when the buffer that GDI draws to is visible.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this