Loading ...
Sorry, an error occurred while loading the content.

1702Re: List View header control

Expand Messages
  • brentje
    Feb 28, 2007
    • 0 Attachment
      Hi

      I haven't had the chance to run any code yet, but I did notice
      something in your code. The WM_NOTIFY code is 0x004E, which is below
      WM_USER (0x1024), so you don't need to do the AllocateVirtualBuffer
      code. Read here for more info:

      http://www.piotrkaluski.com/files/winguitest/docs/ch02s04.html#id5397419

      Basically you should be able to pass $str_buf directly into the
      SendMessage call. If that's not it...well...good luck...

      Brent

      --- In perlguitest@yahoogroups.com, "jonnyroberts1978"
      <jonnyroberts1978@...> wrote:
      >
      > Hello,
      >
      > I am testing an application which has a listview control which has
      > sorting. The sorting is carried out when the column titles are clicked
      > with the mouse. I am able to get a handle to the header control by
      > sending the LVM_GETHEADER message. However, I can't seem to simulate a
      > click on the header control.
      >
      > I am trying to send the HDN_ITEMCLICK message which is a WM_NOTIFY
      > message. The code I have is as follows:
      >
      > #Get the header control Commctrl.h LVM_GETHEADER
      > my $header = SendMessage( $listView, 0x1000 + 31, 0, 0 );
      >
      > #Make sure we have the header
      > if($header != 0)
      > {
      > #typedef struct tagNMHEADER {
      > # NMHDR hdr;
      > # int iItem;
      > # int iButton;
      > # HDITEM *pitem;
      > #} NMHEADER, *LPNMHEADER;
      >
      > my $hwnd = $header;
      > my $lvitem = AllocateVirtualBuffer( $hwnd, 400 );
      >
      > #Setup the HMHEADER structure
      > # 322 = (HDN_FIRST-22) comctrl.h
      > my $str_buf = pack( "L L L L L L",
      > 322, #nmh.hdr.code Code
      > $header, #nmh.hdr.hwndFrom hwnd
      > 0, #nmh.hdr.idFrom
      > 0, #Left
      > 0, #First Item
      > 0, #HDITEM, not relevant for this notification
      > );
      >
      > WriteToVirtualBuffer( $lvitem, $str_buf );
      >
      > #WM_NOTIFY == 0x004E
      > SendMessage( $header, 0x004E, $lvitem->{ 'ptr' }, $lvitem->{ 'ptr'
      } );
      >
      > FreeVirtualBuffer( $lvitem );
      > }
      >
      > has anyone got any idea what I am doing wrong as at the moment nothing
      > happens.
      >
      > Have I initialised the structure correctly?
      >
      > Regards
      > Jon
      >
    • Show all 15 messages in this topic