Adjust window size

Source: Internet
Author: User

# 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/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.