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

Started by
18 comments, last by 00702000744 21 years, 11 months ago
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!!!
Advertisement
Are you using full screen directx? Getting a dialog to show up in exclusive mode is a little tricky.
---------------------------------"Without C, all we would have is Pasal, Basi, and obol.""Black holes are where god divided by zero."http://www.insodus.com
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!

Thanks for your suggestions but my program is only within a normal window.

Does anyone else have any clues about my problem??
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(.............);
}
Your very good advice doesn''t fit my situation. I am using Direct3D 8.0!!!!
What if you''re using DirectX 8?
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
I am right now!!!
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).
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.

This topic is closed to new replies.

Advertisement