ش | ی | د | س | چ | پ | ج |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
WINDOWPLACEMENT structure
Contains information about the placement of a window on the screen.
Type WINDOWPLACEMENT
length As Long
flags As Long
showCmd As Integer
ptMinPosition As POINTAPI
ptMaxPosition As POINTAPI
rcNormalPosition As RECT
rcDevice As RECT
End Type
Of course you should measure/obtain the correct border size from your window style by using methods like GetSystemMetrics or GetThemeMetric, its a very simple task. I just wanted to demonstrate how you can change the border size of your frame when switching between the window states.
The size and positions of the caption buttons are now correct, as you can see here
GetWindowPlacement function
Retrieves the show state and the restored, minimized, and maximized positions of the specified window.
Parameters
hWnd
Type: HWND
A handle to the window.
lpwndpl
Type: WINDOWPLACEMENT*
A pointer to the WINDOWPLACEMENTstructure that receives the show state and position information. Before calling GetWindowPlacement, set the lengthmember to sizeof(WINDOWPLACEMENT). GetWindowPlacement fails if lpwndpl-> length is not set correctly.
Return Value
Type: Type: BOOL
If the function succeeds, the return value is nonzero.
Remarks
The flags member of WINDOWPLACEMENTretrieved by this function is always zero. If the window identified by the hWnd parameter is maximized, the showCmd member is SW_SHOWMAXIMIZED. If the window is minimized, showCmd is SW_SHOWMINIMIZED. Otherwise, it is SW_SHOWNORMAL.
The length member of WINDOWPLACEMENTmust be set to sizeof(WINDOWPLACEMENT). If this member is not set correctly, the function returns FALSE. For additional remarks on the proper use of window placement coordinates, see WINDOWPLACEMENT.