Type NCCALCSIZE_PARAMS
rgrc(3) As RECT
lppos As WINDOWPOS
End Type
Type WINDOWPOS
hwndInsertAfter As LongPtr
hwndAs LongPtr
x As Long
y As Long
cx As Long
cy As Long
uflags As Long
End Type
'uflags
SWP_NOSIZE=&H1
SWP_NOMOVE=&H2
SWP_NOZORDER=&H4
SWP_NOREDRAW=&H8
SWP_SHOWWINDOW=&H40
SWP_HIDEWINDOW=&H80
case WM_NCCALCSIZE
Dim ncParams As NCCALCSIZE_PARAMS
(LPNCCALCSIZE_PARAMS) lParam'
ncParams.rgrc(0).top +=4
ncParams.rgrc(0).left +=4
ncParams.rgrc(0).bottom -=4
ncParams.rgrc(0).right -=4
return 0
Case WM_NCPAINT
Dim rc As RECT
GetWindowRect hWnd,rc
region=0
if (wParam=1) Then
region=CreateRectRgn(rect.left, rect.top, rect.right,,
(rect.bottom
else
(copy=CreateRectRgn(0, 0, 0, 0
if (CombineRgn(copy,wParam,0, RGN_COPY)) Then
region=copy
else
(DeleteObject(copy
End if
End if
dc=GetDCEx(hWnd,region, DCX_WINDOW+DCX_CACHE+DCX_INTERSECTRGN+DCX_LOCKWINDOWUPDATE)
if Not (dc Or region) Then
DeleteObject region
End if
((pen=CreatePen(PS_INSIDEFRAME, 4, RGB(255, 0, 0
(old=SelectObject(dc, pen
width=rect.right-rect.left
height=rect.bottom-rect.top
Rectangle dc, 0, 0, width,height
SelectObject dc, old
ReleaseDC hWnd, dc
DeleteObject pen
return 0
End If
case WM_NCACTIVATE
(RedrawWindow(hWnd,0,0,RDW_UPDATENOW
return 0
(rgn=CreateRectRgn(0,0,0,0
(int s=GetWindowRgn(Hwnd, rgn
if wparam=0 '
()topRgn=CreateRectRgn(0, 10,GetSize().GetWidth(()GetSize().GetHeight
(newRgn=CreateRectRgn(0,0,0,0
(CombineRgn newRgn,rgn,topRgn,RGN_AND
(s = SetWindowRgn(GetHwnd(), newRgn, true
case WM_NCCALCSIZE
(if (wParam=TRUE
NCCALCSIZE_PARAMS *pncsp = reinterpret_cast<NCCALCSIZE_PARAMS*>(lParam);
pncsp.rgrc(0).left=pncsp.rgrc(0).left+5
pncsp.rgrc(0).top=pncsp.rgrc(0).top+5
pncsp.rgrc(0).right=pncsp.rgrc(0).right-5
pncsp.rgrc(0).bottom=pncsp.rgrc(0).bottom-5
(MSWDefWindowProc(message, wParam, lParam
r=WVR_REDRAW
else
(MSWDefWindowProc(message, wParam, lParam
r = 0
End if
WVR_ALIGNTOP=&H10
WVR_ALIGNLEFT=&H20
WVR_ALIGNBOTTOM=&H40
WVR_ALIGNRIGHT=&H80
WVR_HREDRAW=&H100
WVR_VREDRAW=&H200
WVR_REDRAW=&H300
you set the size of the non-client area by handling the WM_NCCALCSIZE
message. But don't do this unless you plan to do all of the non-client drawing as well by handling WM_NCPAINT
case WM_NCCALCSIZE
lRet = 0
const int cxBorder = 2
const int cyBorder = 2
(InflateRect((LPRECT)lParam,-cxBorder, -cyBorder
case WM_NCCALCSIZE
'{ LPNCCALCSIZE_PARAMS pncc ='(LPNCCALCSIZE_PARAMS)lParam
pncc.rgrc(0)is the new rectangle '
pncc.rgrc(1) is the old rectangle'
pncc.rgrc(2) is the client rectangle'
lRet=DefWindowProc(hwnd,
(WM_NCCALCSIZE,wParam,lParam
pncc.rgrc(0).top +=ExtraCaptionHeight
WM_NCCALCSIZE=&H83
case WM_NCPAINT
HRGN)wParam)
hdic=GetDCEx(hwnd,(HRGN)wParam,DCX_WINDOW+DCX_CACHE+DCX_INTERSECTRGN)
GetWindowRect hwnd,rect
((b=CreateSolidBrush(RGB(180,180,180
SelectObject hdic,b
((pe=CreatePen(PS_SOLID, 1, RGB(90, 90, 90
SelectObject hdic,pe
-Rectangle hdic,0,0,(rect.right-rect.left),(rect.bottom
((rect.top
DeleteObject pe
DeleteObject b
ReleaseDC hwnd,hdic
RedrawWindow
(hwnd,rect,(HRGN)wParam,RDW_UPDATENOW
return 0
RDW_ALLCHILDREN = 128
RDW_ERASE = 4
RDW_ERASENOW = 512
RDW_FRAME = 1024
RDW_INTERNALPAINT = 2
RDW_INVALIDATE =1
RDW_NOCHILDREN = 64
RDW_NOERASE = 32
RDW_NOFRAME = 2048
RDW_NOINTERNALPAINT = 16
RDW_UPDATENOW = 256
RDW_VALIDATE = 8