简体   繁体   中英

How do you programmatically resize and move windows with the Windows API?

How do you programmatically resize and move windows with Windows API?

The scenario is: I want to vertically tile two windows (80%/20% width proportions).

For flicker-free, simultaneously positioning two (or more) windows, your best bet is to use BeginDeferWindowPos() , DeferWindowPos() and EndDeferWindowPos() . In your case, since you're moving two at the same time, this is your best bet.

Three older, simpler functions you might also consider are SetWindowPos() , MoveWindow() and AdjustWindowRectEx() .

Use SetWindowPos() in the Windows API.

Given a HWND, you can change the z-order, position (upper left), size, as well as numerous other flags (like showing or hiding, making it the active window or not, etc).

You're looking for one of SetWindowPos , MoveWindow and AdjustWindowRectEx .

Can you be more specific about the scenario so that we can recomend the most appropriate API?

SetWindowPos或MoveWindow将为您完成此任务

在SDK文档中查找MoveWindow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM