heh, bob, Just make sure you pay homage to Galen Nickerson the author of
that ...
http://www.vbcodemagician.dk/tips/cctrls_lvpreventresize.htm
"Bob" wrote in message
news:5436391@discussion.autodesk.com...
here is your second installment. enjoy!
Public Sub Hook()
'establish hook to capture messages to this window
lpPrevWndProc = SetWindowLong(gHW, GWL_WNDPROC, AddressOf WindowProc)
End Sub
Public Sub Unhook()
Dim temp As Long
'reset the message handler for this window
temp = SetWindowLong(gHW, GWL_WNDPROC, lpPrevWndProc)
End Sub
Public Function WindowProc(ByVal hwnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Dim nmh As NMHDR
Dim nmhd As NMHEADER
Select Case uMsg
Case WM_NOTIFY
'fill the NMHDR struct from the lParam pointer.
'(for any WM_NOTIFY msg, lParam always points to a struct
'which is either the NMHDR struct, or whose 1st member is the
'NMHDR struct)
Call MoveMemory(nmh, ByVal lParam, Len(nmh))
'could combine HDN_BEGINTRACK
'and HDN_DIVIDERDBLCLICK into one
'(i.e.,Case HDN_BEGINTRACK, HDN_DIVIDERDBLCLICK:)
Select Case nmh.code
Case HDN_BEGINTRACK
'User began dragging a divider
Call MoveMemory(nmhd, ByVal lParam, Len(nmhd))
Select Case nmhd.iItem
'Select Case ListView ColumnHeader Index you want to prevent
tracking.
'Note API is 0 based unlike ColumnHeaders collection which is 1
based.
Case 0
'ListView ColumnHeader Index 1 prevent tracking
WindowProc = 1
Exit Function
Case 1
'ListView ColumnHeader Index 2 prevent tracking
WindowProc = 1
Exit Function
Case Else
'other ColumnHeaders allow resizing
End Select
Case HDN_DIVIDERDBLCLICK
'user double clicked the divider area
Call MoveMemory(nmhd, ByVal lParam, Len(nmhd))
Select Case nmhd.iItem
'Select Case ListView ColumnHeader Index
'you want to prevent resizing if the user double clicks on a
Column separator
'Note API is 0 based unlike ColumnHeaders collection which is 1
based
Case 0
'ListView ColumnHeader Index 1
'prevent resizing if the user double clicks on a Column
separator
WindowProc = 1
Exit Function
Case 1
'ListView ColumnHeader Index 2
'prevent resizing if the user double clicks on a Column
separator
WindowProc = 1
Exit Function
Case Else
'other ColumnHeaders allow resizing
End Select
End Select
End Select
'Pass message on to the original window message handler
WindowProc = CallWindowProc(lpPrevWndProc, hwnd, uMsg, wParam, lParam)
End Function
"Tony Tanzillo" wrote in message
news:5435599@discussion.autodesk.com...
Bobo....
Any idiot can copy commonly-used WinAPI
function import declarations that can be found
in thousands of places on the net and in books,
and paste them into a post here.
So, who do you think you're fooling?
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
"Bob" wrote in message
news:5435528@discussion.autodesk.com...
yeah, i figured you didn't know. so i'll start educating you. here is your
first installment.