c++ - Window creation fails with non-NULL hMenu parameter -
in addition main window, i'm trying create top level window. problem when i'm setting second window's hmenu
parameter non-null value, doesn't show up.
e.g:
this window shows (hmenu == 0)
case idc_button_send_command: { createwindowexw(null, l"commandwindow", l"send command", ws_visible | ws_overlapped | ws_caption | ws_sysmenu | ws_minimizebox, 100, 100, 600, 400, null, (hmenu)0, (hinstance)getwindowlong(hwnd, gwl_hinstance), null); break; }
this window doesn't show (hmenu == 4)
case idc_button_send_command: { createwindowexw(null, l"commandwindow", l"send command", ws_visible | ws_overlapped | ws_caption | ws_sysmenu | ws_minimizebox, 100, 100, 600, 400, null, (hmenu)4, (hinstance)getwindowlong(hwnd, gwl_hinstance), null); break; }
i'm using windows 7.
passing (hmenu)4
hmenu
parameter createwindowex
create top level window tells system attach menu it. menu has menu handle 4. menu handle (hmenu
) returned functions createmenu
. if handle not valid hmenu
window creation fails.
your observation, window doesn't show up misleading believing window exists. window doesn't exist, , createwindowex
returns null
. checking return values advisable, , calling getlasterror
when api call fails quite helpful.
Comments
Post a Comment