c# - How to use WinAPI to cover another window -
I have 2 windows, or window handles I have to get the position and size of a window, and in the second window To apply, so that the second window can be fully covered first. For now, I am using GetWindowRect ()
to get the position and size of a window, for example,
IntPtr hWnd1 = some window handles; Rect rect = new rect (); GetWindowRect (HWND1, Riff Rect);
After some googling, it seems that I have to use SetWindowPos ()
to move my second window to the top and change its size
Set Window POS (HW2, some quotes here); However, I do not know how to convert the RECT
structure to GetWindowRect ()
to coordinate by how I SetWindowPos ()
, any help appreciated.
I think you should say "left, top, right, down" to "x, y, width , Height ":
RECT rct = GetWindowRect (windowHandler); SetWindowPos (WindowHandler, HWTPTP, RTT Lift, RCT, RTT Right-RCT Lift, RTT.Botom - RCTOp, SWPISHOWADO);
update
You should use GetWindowPlacement instead of GetWindowRect , such as:
WindowsPlace; Bool ok = GetWindowPlacement (hwndTarget, exclude place); OK = Set Window POS (HWDSRC, new INTERPTR (0), place General post Lift, place General condition place, normal post, place Normal post. Highlight, set window pseflag, shovindo);
Note that this will only work if the window is in "restored" status (not maximum).
I'm removing the interop import and structures, you can find it and
Comments
Post a Comment