ListView WndProc constant search

  • Thread starter Thread starter Marc Robitaille
  • Start date Start date
M

Marc Robitaille

Hello,

I have created a new ListView control that inherits from ListView control.
In the WndProc override subroutine, I have been able to find and use those
constants :
Private Const SBM_SETSCROLLINFO As Integer = &HE9
Private Const WM_HSCROLL As Integer = &H115
Private Const WM_VSCROLL As Integer = &H114

So i know when the user is using the scroll bar of the listview control.
What I need is the constant to know when the user changes the size of the
columns in the listview. I tried to find this value but with no success. Is
there Anybody who knows this value?

thank you
 
Marc,
What I need is the constant to know when the user changes the size of the
columns in the listview. I tried to find this value but with no success. Is
there Anybody who knows this value?

I believe the header control will notify the listview with WM_NOTIFY
(&H4E) messages where the code in the NMHDR structure is
HDN_ITEMCHANGING (-300 or -320) or HDN_ITEMCHANGED (-301 or -321).


Mattias
 
Marc Robitaille said:
I have created a new ListView control that inherits from ListView control.
In the WndProc override subroutine, I have been able to find and use those
constants :
[...]
What I need is the constant to know when the user changes the size of the
columns in the listview. I tried to find this value but with no success.
Is there Anybody who knows this value?

If you are using .NET 2.0, check out the listview class'
'OnColumnWidthChanging' and 'OnColumnWidthChanged' methods.
 
I am using .NET 1.1
thank you

--
Marc R.
E-mail
Dim strAddr As String =Convert.ToString(String.Format("{0}.{2}@{3}.{1}",
"mxrc", "cx", "robitxille", "xrs-solutions")).Replace("x", "a")

Herfried K. Wagner said:
Marc Robitaille said:
I have created a new ListView control that inherits from ListView
control.
In the WndProc override subroutine, I have been able to find and use
those
constants :
[...]
What I need is the constant to know when the user changes the size of the
columns in the listview. I tried to find this value but with no success.
Is there Anybody who knows this value?

If you are using .NET 2.0, check out the listview class'
'OnColumnWidthChanging' and 'OnColumnWidthChanged' methods.
 
I am in vb.net. How can i translate this?

I don't know what there is to translate. But I guess the code would
look something like this

Const WM_NOTIFY As Integer = &H4E
Const HDN_ITEMCHANGINGA As Integer = -300
Const HDN_ITEMCHANGINGW As Integer = -320

Protected Overrides Sub WndProc(ByRef m As Message)

If m.Msg = Wm_NOTIFY Then
Dim code As Integer = _
Marshal.ReadInt32(m.LParam, 4 + IntPtr.Size)
If code = HDN_ITEMCHANGINGA Or _
code = HDN_ITEMCHANGINGW Then
' ...
End If
End If

MyBase.WndProc(m)
End Sub


At the ... place in in the code you'd have to dereference m.LParam to
a NMHEADER struct, see if the pItem member is valid and if so
dereference that to a HDITEM struct. If its mask member includes
HDI_WIDTH then the width is changing and the new width is in the cxy
member. To prevent the change from happening you set m.Result to 1.


Mattias
 
Back
Top