# Include "stdafx. H "</P> <p> bool zoom_window (hwnd, lprect lptargetrect, lprect morgrect, bool bzoomex_only) <br/>{< br/> If (hwnd) <br/>{< br/> crect taregetex_pos = lptargetrect; </P> <p> bool isvisable = iswindowvisible (hwnd ); // keep visible </P> <p>: setwindowpos (hwnd, 0, 0, 0, 0, 0, <br/> swp_nozorder | swp_nosize | swp_hidewindow ); // hide the window </P> <p> If (! Bzoomex_only) <br/>{< br/> crect srcwndrect; <br/> If (morgrect) <br/>{< br/> srcwndrect = morgrect; <br/>}< br/> else <br/> {<br/> getwindowrect (hwnd, & srcwndrect ); <br/>}</P> <p> DWORD style = getwindowlong (hwnd, gwl_style); </P> <p> int board_dx = 0, board_dy = 0; </P> <p> If (ws_caption = (Style & ws_caption) <br/>{< br/> board_dy + = getsystemmetrics (sm_cycaption ); <br/>}</P> <p> If (ws_dlgbps Ame = (Style & ws_dlgframe) <br/>{< br/> board_dx + = 2 * getsystemmetrics (sm_cxborder ); <br/> board_dy + = 2 * getsystemmetrics (sm_cyborder); <br/>}< br/> else if (ws_border = (Style & ws_border )) <br/>{< br/> board_dx + = getsystemmetrics (sm_cxborder); <br/> board_dy + = getsystemmetrics (sm_cyborder ); <br/>}< br/> else <br/>{< br/>}</P> <p> double dx = (double) (taregetex_pos.width ()-boa Rd_dx)/(double) (srcwndrect. width ()-board_dx); <br/> double DY = (double) (taregetex_pos.height ()-board_dy)/(double) (srcwndrect. height ()-board_dy); </P> <p> hwnd hchild =: getwindow (hwnd, gw_child); <br/> while (hchild! = NULL) <br/>{< br/> crect rect; <br/> getwindowrect (hchild, & rect); <br/> cpoint pt_lt (rect. left, rect. top); <br/> screentoclient (hwnd, & pt_lt); <br/> movewindow (hchild, <br/> (INT) (pt_lt.x * dx ), <br/> (INT) (pt_lt.y * Dy), <br/> (INT) (rect. width () * dx), <br/> (INT) (rect. height () * Dy), true); </P> <p> hchild = getwindow (hchild, gw_hwndnext ); <br/>}</P> <p> uint nflage = swp_nozorder | swp_drawframe | swp_defererase; <br/> If (isvisable) nflage | = swp_showwindow; <br/>: setwindowpos (hwnd, 0, <br/> taregetex_pos.left, taregetex_pos.top, taregetex_pos.width (), taregetex_pos.height (), <br/> nflage ); <br/>}< br/> return (false); <br/>}< br/>