Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. WM_NOTIFY Reports incorrect values

WM_NOTIFY Reports incorrect values

Scheduled Pinned Locked Moved Visual Basic
csharphelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Knight Lore
    wrote on last edited by
    #1

    Im new to vb.net and Im trying to move mi apliccations to the new language...and i have the following problem. Im trying to intercept the ListView messages because i want a LV footer to autoresize when a column resize. I create a Class inherit a LV and override the WndProc sub. But when i try to intercept the WM_NOTIFY message, the asociated code seems incorrect. Here is my code (the class): ----------------------------------------------------------------------------- Public Class MyListView Inherits System.Windows.Forms.ListView Structure NMHDR Dim hwndFrom As Long ' Window handle of control sending message Dim idFrom As Long ' Identifier of control sending message Dim code As Long ' Specifies the notification code End Structure Structure NMHEADER Dim hdr As NMHDR Dim iItem As Long Dim iButton As Long Dim lPtrHDItem As Long ' HDITEM FAR* pItem End Structure Public Const WM_NOTIFY = &H4E Public Const WM_PAINT = &HF Public Const WM_USER = &H400 Public Const WM_REFLECT = WM_USER + &H1C00 Const HDN_FIRST As Long = -300& Const HDN_LAST As Long = -399& Const HDN_GETDISPINFO As Long = (HDN_FIRST - 9) Const HDN_BEGINDRAG As Long = (HDN_FIRST - 10) Const HDN_ENDDRAG As Long = (HDN_FIRST - 11) Const HDN_ITEMCLICK As Long = (HDN_FIRST - 2) Const HDN_ITEMDBLCLICK As Long = (HDN_FIRST - 3) Const HDN_DIVIDERDBLCLICK As Long = (HDN_FIRST - 5) Const HDN_ITEMCHANGING As Long = (HDN_FIRST - 0) Const HDN_ITEMCHANGED As Long = (HDN_FIRST - 1) Const HDN_BEGINTRACK As Long = (HDN_FIRST - 6) Const HDN_ENDTRACK As Long = (HDN_FIRST - 7) Const HDN_TRACK As Long = (HDN_FIRST - 8) Const NM_FIRST As Long = -0& ' (0U- 0U) Const NM_CUSTOMDRAW As Long = (NM_FIRST - 12) Const NM_RCLICK As Long = (NM_FIRST - 5) Const NM_RELEASEDCAPTURE As Long = (NM_FIRST - 16) Const NM_CLICK As Long = NM_FIRST - 2 Const LVN_FIRST As Long = 100 Const LVN_COLUMNCLICK As Long = LVN_FIRST - 8 Protected Overrides Sub WndProc(ByRef m As Message) Dim nmh As NMHDR Select Case m.Msg Case WM_NOTIFY nmh = CType(m.GetLParam(nmh.GetType), NMHDR) If nmh.code = HDN_BEGINTRACK Then MsgBox("track") End If End Select MyBase.WndProc(m) End Sub End Class '

    N 1 Reply Last reply
    0
    • K Knight Lore

      Im new to vb.net and Im trying to move mi apliccations to the new language...and i have the following problem. Im trying to intercept the ListView messages because i want a LV footer to autoresize when a column resize. I create a Class inherit a LV and override the WndProc sub. But when i try to intercept the WM_NOTIFY message, the asociated code seems incorrect. Here is my code (the class): ----------------------------------------------------------------------------- Public Class MyListView Inherits System.Windows.Forms.ListView Structure NMHDR Dim hwndFrom As Long ' Window handle of control sending message Dim idFrom As Long ' Identifier of control sending message Dim code As Long ' Specifies the notification code End Structure Structure NMHEADER Dim hdr As NMHDR Dim iItem As Long Dim iButton As Long Dim lPtrHDItem As Long ' HDITEM FAR* pItem End Structure Public Const WM_NOTIFY = &H4E Public Const WM_PAINT = &HF Public Const WM_USER = &H400 Public Const WM_REFLECT = WM_USER + &H1C00 Const HDN_FIRST As Long = -300& Const HDN_LAST As Long = -399& Const HDN_GETDISPINFO As Long = (HDN_FIRST - 9) Const HDN_BEGINDRAG As Long = (HDN_FIRST - 10) Const HDN_ENDDRAG As Long = (HDN_FIRST - 11) Const HDN_ITEMCLICK As Long = (HDN_FIRST - 2) Const HDN_ITEMDBLCLICK As Long = (HDN_FIRST - 3) Const HDN_DIVIDERDBLCLICK As Long = (HDN_FIRST - 5) Const HDN_ITEMCHANGING As Long = (HDN_FIRST - 0) Const HDN_ITEMCHANGED As Long = (HDN_FIRST - 1) Const HDN_BEGINTRACK As Long = (HDN_FIRST - 6) Const HDN_ENDTRACK As Long = (HDN_FIRST - 7) Const HDN_TRACK As Long = (HDN_FIRST - 8) Const NM_FIRST As Long = -0& ' (0U- 0U) Const NM_CUSTOMDRAW As Long = (NM_FIRST - 12) Const NM_RCLICK As Long = (NM_FIRST - 5) Const NM_RELEASEDCAPTURE As Long = (NM_FIRST - 16) Const NM_CLICK As Long = NM_FIRST - 2 Const LVN_FIRST As Long = 100 Const LVN_COLUMNCLICK As Long = LVN_FIRST - 8 Protected Overrides Sub WndProc(ByRef m As Message) Dim nmh As NMHDR Select Case m.Msg Case WM_NOTIFY nmh = CType(m.GetLParam(nmh.GetType), NMHDR) If nmh.code = HDN_BEGINTRACK Then MsgBox("track") End If End Select MyBase.WndProc(m) End Sub End Class '

      N Offline
      N Offline
      Niels Penneman
      wrote on last edited by
      #2

      First of all, in VB.NET long becomes integer, integer becomes short, ... This may not solve your problem, but will help you with this and future translations :-) I suggest you read the translation guidelines @ MSDN greetz ;-) *Niels Penneman*


      Software/Dev Site
      Personal Site


      K 1 Reply Last reply
      0
      • N Niels Penneman

        First of all, in VB.NET long becomes integer, integer becomes short, ... This may not solve your problem, but will help you with this and future translations :-) I suggest you read the translation guidelines @ MSDN greetz ;-) *Niels Penneman*


        Software/Dev Site
        Personal Site


        K Offline
        K Offline
        Knight Lore
        wrote on last edited by
        #3

        Thanks a lot Niels!! Your sugestion was good, it help me a bit... Now the values looks more "real"....but aparently appears increased in 20 (i.e.: -326 instead -306) But now I'm closer to the solution! Any idea why this happenns?

        N 2 Replies Last reply
        0
        • K Knight Lore

          Thanks a lot Niels!! Your sugestion was good, it help me a bit... Now the values looks more "real"....but aparently appears increased in 20 (i.e.: -326 instead -306) But now I'm closer to the solution! Any idea why this happenns?

          N Offline
          N Offline
          Niels Penneman
          wrote on last edited by
          #4

          Values are NOT incorrect... look what I found :-)

          Hdn_begintrackw: INTEGER is -326
          -- Notifies a header control's parent window that the user has
          -- begun dragging a divider in the control (that is, the user
          -- has pressed the left mouse button while the mouse cursor is
          -- on a divider in the header control). This notification
          -- message is sent in the form of a WM_NOTIFY message.
          --
          -- Declared in Windows as HDN_BEGINTRACK

          I found it here ;-) greetz ;-) *Niels Penneman*


          Software/Dev Site
          Personal Site


          1 Reply Last reply
          0
          • K Knight Lore

            Thanks a lot Niels!! Your sugestion was good, it help me a bit... Now the values looks more "real"....but aparently appears increased in 20 (i.e.: -326 instead -306) But now I'm closer to the solution! Any idea why this happenns?

            N Offline
            N Offline
            Niels Penneman
            wrote on last edited by
            #5

            Correct translation to VB.NET is here:

            Structure NMHDR
                Dim hwndFrom As IntPtr ' Window handle of control sending message 
                Dim idFrom As Integer ' Identifier of control sending message 
                Dim code As Integer ' Specifies the notification code 
            End Structure
            
            Structure NMHEADER
                Dim hdr As NMHDR
                Dim iItem As Integer
                Dim iButton As Integer
                Dim lPtrHDItem As IntPtr ' HDITEM FAR\* pItem 
            End Structure
            

            greetz ;-) *Niels Penneman*


            Software/Dev Site
            Personal Site


            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups