c++ - What should I do to have WS_MAXIMIZE working? -
there how program begins:
int winapi winmain(hinstance hinst, hinstance hprevinst, lpstr lpcmdline, int nshowcmd) { mapeditor mapeditor; mapeditor.run(); return 0; }
and there mapeditor():
mapeditor::mapeditor() { /* creates window */ wndclassex wclass; zeromemory(&wclass,sizeof(wndclassex)); wclass.cbsize=sizeof(wndclassex); wclass.style=cs_hredraw|cs_vredraw; wclass.lpfnwndproc=winproc; wclass.cbclsextra=null; wclass.cbwndextra=null; wclass.hinstance=getmodulehandle(0); wclass.hicon=null; wclass.hcursor=loadcursor(null,idc_arrow); wclass.hbrbackground=(hbrush)color_window; wclass.lpszmenuname=null; wclass.lpszclassname="map editor"; wclass.hiconsm=null; if(!registerclassex(&wclass)) { int nresult=getlasterror(); messagebox(null,"failed register window class","window class failed",mb_iconerror); } me_hwnd=createwindowex(null, "map editor", "map editor", ws_overlappedwindow | ws_maximize | ws_visible, cw_usedefault, cw_usedefault, cw_usedefault, cw_usedefault, null, null, getmodulehandle(0), this); if(!me_hwnd) { int nresult=getlasterror(); messagebox(null,"window class creation failed","window class failed",mb_iconerror); } showwindow(me_hwnd, ws_maximize); }
the window won't ever start maximized. why?
"it looks post code; please add more details." "it looks post code; please add more details." done!
you passing wrong second parameter showwindow
. second parameter supposed sw_...
value, not ws_...
value, explained in the documentation.
Comments
Post a Comment