Archived

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

dialog box not being drawn

This topic is 5779 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

i''m having problems with my dialog box. it is not being drawn. only the controls(buttons,comboboxes,etc...) are drawn. here''s how i created it (in visual c++): i started the the win32 app project, then inserted resource (dialog). i then edited it, added some stuff and saved it. i then added resource.h and resources.rc to my project. then i created a msg handler: BOOL CALLBACK Setup_Dlg_Proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM) something like: get all dlg items case WM_INITDIALOG .... blabla case WM_COMMAND: case all commands on my controls if exit then EndDialog then i create the dialog box with: DialogBox(hInstance,MAKEINTRESOURCE(IDD_SETUP), 0 , (DLGPROC)Setup_Dlg_Proc); return value is ok, and all commands work, but the dialog box itself is not visible... what''s wrong? Abnormal behavior of abnormal brain makes me normal...

Share this post


Link to post
Share on other sites
what''s annoying me is that i download a tutorial from "http://www.vvsu.ru/dkcsc/dxgp/rgd_news_e.asp?s=news" (russian site on directx programming) tutorial nr4 and i rewrote the whole dialog box stuff for my project. everything is tha same and when i open tutorial project and compile it, dialog box is ok. with my project, well i cant see it!

here''s the tutorial source:
BOOL CALLBACK StartUp_dlg_proc (HWND hWndD, UINT message, WPARAM wParam, LPARAM lParam)
{
HWND hSMlist = GetDlgItem (hWndD, IDC_SCREENMODESW);
HWND hFSMlist = GetDlgItem (hWndD, IDC_SCREENMODESFS);

switch (message)
{
case WM_INITDIALOG:
{
SendDlgItemMessage (hWndD, IDC_WINDOWED, BM_SETCHECK, 1, 0);

ComboBox_ResetContent (hSMlist);
ComboBox_ResetContent (hFSMlist);

ComboBox_AddString (hSMlist, "300 x 200");
ComboBox_AddString (hSMlist, "320 x 240");
ComboBox_AddString (hSMlist, "400 x 300");
ComboBox_AddString (hSMlist, "512 x 384");
ComboBox_AddString (hSMlist, "640 x 400");
ComboBox_AddString (hSMlist, "640 x 480");
ComboBox_AddString (hSMlist, "800 x 600");
ComboBox_AddString (hSMlist, "1024 x 768");
ComboBox_AddString (hSMlist, "1280 x 1024");
ComboBox_SetCurSel (hSMlist, 5);


LPDIRECT3D8 p_d3dt = Direct3DCreate8 (D3D_SDK_VERSION);
D3DDISPLAYMODE d3ddm2;
int allVideoModes = p_d3dt->GetAdapterModeCount (D3DADAPTER_DEFAULT);
for (int i=0; i {
p_d3dt->EnumAdapterModes (D3DADAPTER_DEFAULT, i, &d3ddm2);
char str[30];
int bpp=0;
if(d3ddm2.Format == D3DFMT_X1R5G5B5) bpp=16;
if(d3ddm2.Format == D3DFMT_R5G6B5) bpp=16;
if(d3ddm2.Format == D3DFMT_A1R5G5B5) bpp=16;
if(d3ddm2.Format == D3DFMT_A4R4G4B4) bpp=16;
if(d3ddm2.Format == D3DFMT_X4R4G4B4) bpp=16;
if(d3ddm2.Format == D3DFMT_R8G8B8) bpp=24;
if(d3ddm2.Format == D3DFMT_X8R8G8B8) bpp=32;
if(d3ddm2.Format == D3DFMT_A8R8G8B8) bpp=32;
sprintf(str, "%dx%dx%d _ %dhz", d3ddm2.Width, d3ddm2.Height, bpp, d3ddm2.RefreshRate);
ComboBox_AddString (hFSMlist, str);
};
_RELEASE_ (p_d3dt);
ComboBox_SetCurSel (hFSMlist, 0);

EnableWindow (hSMlist, true);
EnableWindow (hFSMlist, false);

}
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_WINDOWED:
EnableWindow (hSMlist, true);
EnableWindow (hFSMlist, false);
break;

case IDC_FULLSCREEN:
EnableWindow (hSMlist, false);
EnableWindow (hFSMlist, true);
break;

case IDOK:
isFullScreen=false;
if(SendDlgItemMessage(hWndD, IDC_FULLSCREEN, BM_GETCHECK, 0, 0)) isFullScreen=true;

if(isFullScreen)
{
LPDIRECT3D8 p_d3dt = Direct3DCreate8 (D3D_SDK_VERSION);
int dwItem = ComboBox_GetCurSel (hFSMlist);
p_d3dt->EnumAdapterModes (D3DADAPTER_DEFAULT, dwItem, &d3ddm);
_RELEASE_ (p_d3dt);
}
else
{
int dwItem = ComboBox_GetCurSel (hSMlist);
if(dwItem==0) ScreenX=300, ScreenY=200;
if(dwItem==1) ScreenX=320, ScreenY=240;
if(dwItem==2) ScreenX=400, ScreenY=300;
if(dwItem==3) ScreenX=512, ScreenY=384;
if(dwItem==4) ScreenX=640, ScreenY=400;
if(dwItem==5) ScreenX=640, ScreenY=480;
if(dwItem==6) ScreenX=800, ScreenY=600;
if(dwItem==7) ScreenX=1024, ScreenY=768;
if(dwItem==8) ScreenX=1280, ScreenY=1024;
};

EndDialog (hWndD, true);
break;

case IDCANCEL:
EndDialog (hWndD, false);
break;
};
default:
break;
};
return false;
};


and the creation:
if(!DialogBox (hThisInst, MAKEINTRESOURCE(IDD_STARTUP), 0 , (DLGPROC) StartUp_dlg_proc)) return false;


any ideas?!?

Abnormal behavior of abnormal brain makes me normal...

Share this post


Link to post
Share on other sites