diff --git a/rtl/win16/win31.pp b/rtl/win16/win31.pp index 048323b314..74caa010a5 100644 --- a/rtl/win16/win31.pp +++ b/rtl/win16/win31.pp @@ -515,6 +515,42 @@ const WS_EX_ACCEPTFILES = $00000010; WS_EX_TRANSPARENT = $00000020; +type +{ Window size, position, Z-order, and visibility } + PWINDOWPLACEMENT = ^WINDOWPLACEMENT; + LPWINDOWPLACEMENT = ^WINDOWPLACEMENT; far; + WINDOWPLACEMENT = record + length: UINT; + flags: UINT; + showCmd: UINT; + ptMinPosition: POINT; + ptMaxPosition: POINT; + rcNormalPosition: RECT; + end; + TWindowPlacement = WINDOWPLACEMENT; + +const + WPF_SETMINPOSITION = $0001; + WPF_RESTORETOMAXIMIZED = $0002; + + WM_WINDOWPOSCHANGING = $0046; + WM_WINDOWPOSCHANGED = $0047; + +type +{ WM_WINDOWPOSCHANGING/CHANGED struct pointed to by lParam } + PWINDOWPOS = ^WINDOWPOS; + LPWINDOWPOS = ^WINDOWPOS; far; + WINDOWPOS = record + hwnd: HWND; + hwndInsertAfter: HWND; + x: SmallInt; + y: SmallInt; + cx: SmallInt; + cy: SmallInt; + flags: UINT; + end; + TWindowPos = WINDOWPOS; + function GetFreeSystemResources(SysResource: UINT): UINT; external 'USER'; procedure LogError(err: UINT; lpInfo: FarPointer); external 'KERNEL'; @@ -666,6 +702,10 @@ function RegisterClass(lpwc: LPWNDCLASS): ATOM; external 'USER'; function RegisterClass(var wc: WNDCLASS): ATOM; external 'USER'; {$endif} +{ Window size, position, Z-order, and visibility } +function GetWindowPlacement(hwnd: HWND; lpwndpl: LPWINDOWPLACEMENT): BOOL; external 'USER'; +function SetWindowPlacement(hwnd: HWND; lpwndpl: LPWINDOWPLACEMENT): BOOL; external 'USER'; + implementation end. diff --git a/rtl/win16/winprocsh.inc b/rtl/win16/winprocsh.inc index aee0ff1280..f8dfed8557 100644 --- a/rtl/win16/winprocsh.inc +++ b/rtl/win16/winprocsh.inc @@ -848,3 +848,21 @@ function GetWindowWord(hwnd: HWND; nOffset: SmallInt): WORD; external 'USER'; function SetWindowWord(hwnd: HWND; nOffset: SmallInt; nVal: WORD): WORD; external 'USER'; function GetWindowLong(hwnd: HWND; nOffset: SmallInt): LONG; external 'USER'; function SetWindowLong(hwnd: HWND; nOffset: SmallInt; nVal: LONG): LONG; external 'USER'; + +{ Window size, position, Z-order, and visibility } + +procedure GetClientRect(hwnd: HWND; lprc: LPRECT); external 'USER'; +procedure GetWindowRect(hwnd: HWND; lprc: LPRECT); external 'USER'; +{$ifdef VAR_PARAMS_ARE_FAR} +procedure GetClientRect(hwnd: HWND; var rc: RECT); external 'USER'; +procedure GetWindowRect(hwnd: HWND; var rc: RECT); external 'USER'; +{$endif} + +function SetWindowPos(hwnd, hwndInsertAfter: HWND; x, y, cx, cy: SmallInt; fuFlags: UINT): BOOL; external 'USER'; + +function BeginDeferWindowPos(cWindows: SmallInt): HDWP; external 'USER'; +function DeferWindowPos(hdwp: HDWP; hwnd, hwndInsertAfter: HWND; x, y, cx, cy: SmallInt; flags: UINT): HDWP; external 'USER'; +function EndDeferWindowPos(hdwp: HDWP): BOOL; external 'USER'; + +function MoveWindow(hwnd: HWND; nLeft, nTop, nWidth, nHeight: SmallInt; fRepaint: BOOL): BOOL; external 'USER'; +function BringWindowToTop(hwnd: HWND): BOOL; external 'USER'; diff --git a/rtl/win16/wintypes.inc b/rtl/win16/wintypes.inc index d8ca83529a..4b3b238922 100644 --- a/rtl/win16/wintypes.inc +++ b/rtl/win16/wintypes.inc @@ -1547,3 +1547,52 @@ const GWW_ID = (-12); GWL_STYLE = (-16); GWL_EXSTYLE = (-20); + +{ Window size, position, Z-order, and visibility } + + CW_USEDEFAULT = SmallInt($8000); + +{ SetWindowPos() and WINDOWPOS flags } + SWP_NOSIZE = $0001; + SWP_NOMOVE = $0002; + SWP_NOZORDER = $0004; + SWP_NOREDRAW = $0008; + SWP_NOACTIVATE = $0010; + SWP_FRAMECHANGED = $0020; { The frame changed: send WM_NCCALCSIZE } + SWP_SHOWWINDOW = $0040; + SWP_HIDEWINDOW = $0080; + SWP_NOCOPYBITS = $0100; + SWP_NOOWNERZORDER = $0200; { Don't do owner Z ordering } + + SWP_DRAWFRAME = SWP_FRAMECHANGED; + SWP_NOREPOSITION = SWP_NOOWNERZORDER; + + SWP_NOSENDCHANGING = $0400; + SWP_DEFERERASE = $2000; + +{ SetWindowPos() hwndInsertAfter field values } + HWND_TOP = HWND(0); + HWND_BOTTOM = HWND(1); + HWND_TOPMOST = HWND(-1); + HWND_NOTOPMOST = HWND(-2); + +type + HDWP = THandle; + +const + WM_MOVE = $0003; + WM_SIZE = $0005; + +{ WM_SIZE message wParam values } + SIZE_RESTORED = 0; + SIZE_MINIMIZED = 1; + SIZE_MAXIMIZED = 2; + SIZE_MAXSHOW = 3; + SIZE_MAXHIDE = 4; + +{ Obsolete constant names } + SIZENORMAL = SIZE_RESTORED; + SIZEICONIC = SIZE_MINIMIZED; + SIZEFULLSCREEN = SIZE_MAXIMIZED; + SIZEZOOMSHOW = SIZE_MAXSHOW; + SIZEZOOMHIDE = SIZE_MAXHIDE;