windows - Visual c++ can't maximize an application -
i made little exe giving me state of window , maximize when minimized. works regular application calculator. not work application need maximize. application minimized in task bar, full screen application displaying images in dual screen setup.
isiconic work on calculator return false on application.
iswindowvisible return false, showwindow not working if command reruned iswindowvisible return true.
if use nircmd.exe command nircmd win max title "app name" application return fullscreen on 2 screen.
tried postmessage sc_restore or sc_maximize no avail
here's code
hwnd hwnd = findwindow(null, "application name"); if (iswindow(hwnd)) { setforegroundwindow(hwnd); // i'll give focus window. working. std::cout << "visible " << iswindowvisible(hwnd) << std::endl; if(!iswindowvisible(hwnd)) { std::cout << "maximized " << std::endl; showwindow(hwnd, sw_maximize); // working if window minimized while in fullscreen mode //postmessage(hwnd, wm_syscommand, sc_restore, 0); } }
hwnd hwnd = findwindow(null, "application name"); rect rect; // initial rect desired size int width = rect.right - rect.left; int height =rect.bottom - rect.top; ::movewindow(hwnd,rect.left,rect.top,width,height,true); ::bringwindowtotop(hwnd); fromhandle(hwnd)->showwindow(true); fromhandle(hwnd)->setwindowpos(&cwnd::wndtopmost,rect.left,rect.top,width,height,swp_framechanged |swp_showwindow );`
Comments
Post a Comment