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

Started by
18 comments, last by 00702000744 21 years, 11 months ago
Hi:

First of all, I want to say thanks for all the helps from you!!

I have done all you have suggested me to do,BUT...(sigh)the dialog just didn''t show up!!

This is the worst truoble i have ever got into!
Advertisement
First of all, does "MessageBox(m_hWnd, "test", "test", 0);" (copy that into your app) work?

If it does, then did you set a message pump up for your dialog?
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
MessageBox does show up properly and I did set a message pump for my dialog! Here is how i did it:

// Translate and dispatch the message
if(!m_hDialog || !IsDialogMessage(m_hDialog,&msg))
{
// is not a dialog message
if( 0 == TranslateAccelerator( m_hWnd, hAccel, &msg ) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
}
//and i have a DialogProc() function that handles the dialog messages specifically
DirectX works perfectly with dialog boxes, so you might want to post a little more code to take a look at. It could be anything from needing a class definition in the resource or something else...


Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX
There''s a doc on MSDN here...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/dlgboxes_0kag.asp
Hopefully there''ll be something there that helps.

If not, then it may be the case that you''re either not handling your WM_INITDIALOG message correctly or that the controls that aren''t showing up need to be initialised using InitCommonControls or similar.

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Oh, I got my problem fixed already, just need to change the return value to false when the message is not handled manully.

Thanks for all your help!!!
Oh, god, I soon ran into another GUI problem. Now, my dialogbox shows up fine, I added some controls like labels, textboxes to it, everything is just all right! But, once I added a slider(TrackBar) to my dialog, the CreateDialog() function will return a value of NULL. Does anyone have any ideas of how that happened?

Thanks for any help here!!
quote:Original post by 00702000744
But, once I added a slider(TrackBar) to my dialog, the CreateDialog() function will return a value of NULL. Does anyone have any ideas of how that happened?

Did you initialize common controls?

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!
Could you please explain what do you exactly mean by initializing common controls?? I did not do anything to my Labels and TextBoxes, but they showed up automatically.
Common controls are additional UI elements introduced with Internet Explorer. You introduce them into your application as follows:
INITCOMMONCONTROLSEX iccx;iccx.dwSize = sizeof( INITCOMMONCONTROLSEX );// initialize toolbar, status bar, trackbar, ToolTip, and ReBar control classesiccx.dwICC  = ICC_BAR_CLASSES|ICC_COOL_CLASSES;if( ! InitCommonControlsEx( &iccx ) )  return -1; 

See MSDN (link in sig) for more info.

[ GDNet Start Here | GDNet Search Tool | GDNet FAQ ]
[ MS RTFM [MSDN] | SGI STL Docs | Boost ]
[ Google! | Asking Smart Questions | Jargon File ]
Thanks to Kylotan for the idea!

This topic is closed to new replies.

Advertisement