For some reason my variable iPrevHeight keeps changing everytime I collapse and resize my window ... Here is the relevant code ...
(iPrevHeight is an int in the struct lpms)
Code:
case WM_NCLBUTTONDBLCLK: {
if( wParam == HTCAPTION && !lpms->bCollapsed ) {
RECT rc;
GetWindowRect( hwnd, &rc );
rc.right-=rc.left;
rc.bottom-=rc.top;
int n = (int)GetSystemMetrics(SM_CYCAPTION);
if ( rc.bottom <= n )
return 0;
lpms->iPrevHeight = rc.bottom+n;
SetWindowPos( hwnd, HWND_TOPMOST, 1,1,rc.right,n, SWP_NOMOVE );
lpms->bCollapsed = true;
}else if ( wParam == HTCAPTION && lpms->bCollapsed ) {
RECT rc;
GetClientRect( hwnd, &rc );
SetWindowPos( hwnd, HWND_TOPMOST, 1,1,rc.right,lpms->iPrevHeight, SWP_NOMOVE );
lpms->bCollapsed = false;
}
return 0;
}