Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Directx + GUI == WHAT THE???!!!

This topic is 5860 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi: I am trying to create a modeless dialog in my directx program. But when the dialog is supposed to be showed after the call ShowWindow(..), only two buttons on the dialog appear. It is weir and I figured maybe this is a problem caused by conflict between GUI and Directx? Here is my code creating the dialog box: m_hDialog = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_MODIFY_DIALOG), m_hWnd, (DLGPROC)DialogProc); ShowWindow(m_hDialog , SW_SHOW); Any help will be appreciated!!!

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure why, but when I make MessageBox() calls in fullscreen mode, they only show up half the time, and the other half of the time they seem to remain "Behind" the game, but still accept keyboard input.

This post has been totally useless!

Share this post


Link to post
Share on other sites
I also meet this problem before. You need set the window style to CLIPCHILDREN

e.g hWnd = CreateWindowEx(WS_EX_APPWINDOW, "Game", "Testing", WS_BORDER | CLIPCHILDREN, ......);

and then use the DiretDrawClipper to show the GDI window component.

e.g
void FlipGDI()
{
m_lpPrimary->SetClipper(m_ddClipper);
m_lpPrimary->Blt(.............);
}

Share this post


Link to post
Share on other sites
thats interesting. when i use d3d8 in window (even a fullscreen window) i have no problems with displaying comm dialogs (ie things like fileopen, file svae as, etc). i dont do anything special. in fact the only thing special i did was place the main game loop in a seperate thread so displaying a dialog would not lock my rendering up.

also you may want to have the dialog not be a child of your main window (this may be causing the problems). i dont, but it will still work as expected. not sure if this would be useful for custom dialogs, but worth a shot.

using a seperate thread is NOT the answer. it was working fine before i moved it over. are you doing anything special in wm_paint or wm_nccpaint? you should not be blitting to the screen at all. present() handles that for you.

also make sure your not doing anything funky in your call to present(). in most cases its should be Present(NULL, NULL, NULL, NULL).

Share this post


Link to post
Share on other sites
DirectX 8 does not have a clipper object.

Abort_Retry_Fail, what is happening is that flipping surfaces is causing the main GDI surface to be hidden. Normally when you initialize DirectX, there is the initial front buffer, and one or more back buffers. That first front buffer is the buffer used by Windows GDI to draw stuff, even if it is hidden. Hence, half of the time that GDI buffer is in the back, and the message box cannot be seen. DirectX 8 does not have a FlipToGDISurface function that previous versions have, so I''m not sure how you would remedy that, besides keeping track of where the GDI buffer is in the buffer chain.

a person, I''m not sure if common dialogs will still work if you flip because of the GDI buffer thing. You can get around the problem by blitting from back to front, instead of flipping. I suspect that is what you did there.

00702000744, try messing around with your dialog box styles. You said this was in a normal window. Windows will clip dialogs in a normal window. Try adding the clip siblings and clip children styles to your dialog box like wah_on_2 suggested.

And now for the main purpose of my post, getting Windows GUI to work in full screen D3D 8 Because of the lack of a clipper interface and FlipToGDISurface in D3D 8, I resorted to a hack that involves DIB sections and WM_PRINT. You can read about it here.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!