Sunday 15 June 2014

c++ - Winapi dialog broken on windows xp -



c++ - Winapi dialog broken on windows xp -

i have game on startup shows dialog pick language. works on windows 7/8 not on windows xp (or if set compatibility mode windows xp sp 3). controls shifted downwards , window can't moved, close button don't work.

i create dialog this:

dialog_state = 0; hwnd hwnd = createdialog(null, makeintresource(idd_dialog1), null, picklanguagedialogproc); showwindow(hwnd, sw_show); msg amsg = {}; while(dialog_state == 0 && getmessage(&amsg, null, 0, 0)) { if(!isdialogmessage(hwnd, &amsg)) { translatemessage(&amsg); dispatchmessage(&amsg); } }

message handler:

static int_ptr callback picklanguagedialogproc(hwnd hwnddlg, uint umsg, wparam wparam, lparam lparam) { switch(umsg) { case wm_initdialog: // snip, fill list box homecoming true; case wm_close: destroywindow(hwnddlg); homecoming true; case wm_destroy: dialog_state = 2; homecoming true; case wm_command: // snip break; } homecoming defwindowproc(hwnddlg, umsg, wparam, lparam); }

dialog code:

idd_dialog1 dialogex 0, 0, 148, 146 style ds_setfont | ds_modalframe | ds_fixedsys | ds_center | ws_popup | ws_caption | ws_sysmenu caption "select language" font 8, "ms shell dlg", 400, 0, 0x1 begin defpushbutton "ok",idok,91,125,50,14 pushbutton "cancel",idcancel,7,125,50,14 listbox idc_list2,7,29,134,93,lbs_nointegralheight | ws_vscroll | ws_tabstop ltext "select language (can changed in options later):",idc_static,7,7,134,21 end

compiled on window 8 64bit visual studio 2008. app 32 bit. ideas whats wrong?

changing

return defwindowproc(hwnddlg, umsg, wparam, lparam);

to

return false;

fix problem. looks dialog box need different handling normal window.

c++ windows winapi

No comments:

Post a Comment