WVR_ALIGNBOTTOM = 64
WVR_ALIGNLEFT = 32
WVR_ALIGNRIGHT = 128
WVR_ALIGNTOP = 16
WVR_HREDRAW = 256
WVR_REDRAW = WVR_HREDRAW + WVR_VREDRAW
WVR_VALIDRECTS = 1024
WVR_VREDRAW = 512
Type RECT
left As Long
right As Long
top As Long
bottom As Long
End Typd
Type NCCALCSIZE_PARAMS
rgrc(3) As RECT
lppos As WINDOWPOS
End Type
Type WINDOWPOS
x As Long
y As Long
cx As Long ' width
cy As Long ' heigth
End Type
Dim tNCR As NCCALCSIZE_PARAMS
Dim tWP As WINDOWPOS
If wParam <> 0 Then
lParam containts a pointer to the'
NCCALCSIZE_PARAMS structure:
(CopyMemory tNCR,ByVal lParam, Len(tNCR
the NCCALCSIZE_PARAMS structure contains'
a pointer to the WINDOWPOS structure:
(CopyMemory tWP,ByVal tNCR.lppos, Len(tWP
Set the first rectangle to the WINDOWPOS ' size'
(With tNCR.rgrc(0
Left=tWP.x.
Top=tWP.y.
Right=tWP.x+tWP.cx.
Bottom = tWP.y + tWP.cy.
End With
Now modify the rectangle if we're showing tabs'
to allow space for the tab strip itself'
If (m_bShowTabs) Then
tNCR.rgrc(0).Left=tNCR.rgrc(0).Left+2
tNCR.rgrc(0).Right=tNCR.rgrc(0).Right-2
If (m_eTabAlign=TabAlignBottom) Then
tNCR.rgrc(0).Top=tNCR.rgrc(0).Top+2
tNCR.rgrc(0).Bottom=tNCR.rgrc(0).Bottom-m_lTabHeight
Else
tNCR.rgrc(0).Top=tNCR.rgrc(0).Top+m_lTabHeight
tNCR.rgrc(0).Bottom=tNCR.rgrc(0).Bottom-2
End If
End If
Set the second rectangle to equal the first'
(tNCR.rgrc(1)=tNCR.rgrc(0
CopyMemory ByVal lParam,tNCR, Len(tNCR) ' Tell
:Windows we've modified the size'
ISubclass_WindowProc=WVR_VALIDRECTS
Once this is done, there will be a space for the tabs
Case WM_NCPAINT
Ensure the standard mon-client drawing is'
:completed
(ISubclass_WindowProc=CallOldWindowProc(hWnd,iMsg,wParam,lParam
Do custom drawing: first get a DC to the non-client'
:area
Dim lhDC As Long
(lhDC=GetWindowDC(hWnd
'.... Now can draw in the area we've cleared'
Clear up DC '
ReleaseDC lHDC, hWnd
Check the actual source code for the details of drawing the tabs. The code uses an EnumWindowsProc callback function to determine all of the windows within the MDIClient area, and the WM_MDIGETACTIVEmessage to determine which
.(window is the currently selected MDI child (if any
Finally, we need to intercept the user clicking on a tab or button within the tab control. There are two messages Windows sends to the non-client area to allow you to
:check for mouse events
WM_NCHITTEST
This message allows you to tell Windows that a non-client area should be treated in a particular way, such as title bar or size gripper.
WM_SETCURSOR
This message is used by Windows to determine which cursor to display, however, since it provides the type of mouse action being performed you can use it to determine mouse movement and button presses in the
.area