here is your final installment tony. i hope you have learned something ...
Private Sub Form_Load()
With ListView1
'start listview in upper left-hand corner
.Move 0, 0, ScaleWidth, ScaleHeight
'change the view style to report
.View = lvwReport
'add some columns to demonstrate
.ColumnHeaders.Add , , "Column1"
.ColumnHeaders.Add , , "Column2"
.ColumnHeaders.Add , , "Column3"
.ColumnHeaders.Add , , "Column4"
'store listview handle
gHW = .hwnd
End With
Hook
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unhook
End Sub
oh, one final note ... thanks to everyone who has ever posted the code
contained in these lessons. although it has been written and re-written by
everyone and his first cousin i give each and everyoe of you credit [except
for tony].
Bob
"Tony Tanzillo" wrote in message
news:5437737@discussion.autodesk.com...
Stop posting code that is not yours; which
you did not write; which could not write; which
you do not have a clue about or understand;
and for which you are not crediting the original
source or author.
You're violating the forum rules; infringing on the
intellectual property rights of the original author;
and most importantly; You are fooling no one here,
Bobo.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com
"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.