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. C / C++ / MFC
  3. Getting a WM_LBUTTONUP in a listview

Getting a WM_LBUTTONUP in a listview

Scheduled Pinned Locked Moved C / C++ / MFC
5 Posts 3 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.
  • J Offline
    J Offline
    Jim Crafton
    wrote on last edited by
    #1

    OK, I know this sounds crazy (or at least it does to me), but I apparently when using the ListView control with multi selection turned on, you do not get WM_LBUTTONUP messages. (Q149275 and Q149326 in MSDN). Does anyone know of a better workaround than hassling with setting a window Hook to try and trap the message ? It definitely is there in - you can see it using Spy++. What a stupid damn thing to have to track down ! Oh well :) - Any help will be much appreciated

    L T 2 Replies Last reply
    0
    • J Jim Crafton

      OK, I know this sounds crazy (or at least it does to me), but I apparently when using the ListView control with multi selection turned on, you do not get WM_LBUTTONUP messages. (Q149275 and Q149326 in MSDN). Does anyone know of a better workaround than hassling with setting a window Hook to try and trap the message ? It definitely is there in - you can see it using Spy++. What a stupid damn thing to have to track down ! Oh well :) - Any help will be much appreciated

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Does WM_LBUTTONUP show up in PreTranslateMessage? Just an idea

      1 Reply Last reply
      0
      • J Jim Crafton

        OK, I know this sounds crazy (or at least it does to me), but I apparently when using the ListView control with multi selection turned on, you do not get WM_LBUTTONUP messages. (Q149275 and Q149326 in MSDN). Does anyone know of a better workaround than hassling with setting a window Hook to try and trap the message ? It definitely is there in - you can see it using Spy++. What a stupid damn thing to have to track down ! Oh well :) - Any help will be much appreciated

        T Offline
        T Offline
        Tomasz Sowinski
        wrote on last edited by
        #3

        These KB articles describe problems with Visual Basic control, not the listview in general. And you see these messages in Spy++ - so what's the problem - your handler is not called? Tomasz Sowinski -- http://www.shooltz.com.pl

        J 1 Reply Last reply
        0
        • T Tomasz Sowinski

          These KB articles describe problems with Visual Basic control, not the listview in general. And you see these messages in Spy++ - so what's the problem - your handler is not called? Tomasz Sowinski -- http://www.shooltz.com.pl

          J Offline
          J Offline
          Jim Crafton
          wrote on last edited by
          #4

          Well first off I'm not using MFC though I did a test and the same thign happens. I have sub classed the listview control, and in my WndProc the WM_LBUTTONUP does not get called except under odd circumstances as described in the KB articles. For example - I can click on another window, drag the mouse ovwer the list view, and then release, and then I get a WM_LBUTTONUP, but just a press and release of the mouse on the listview control does not send a WM_LBUTTONUP. If I set the LVS_SINGLESEL style bit then I do get WM_LBUTTONUP as long as I dont click on any item. This is very weird ? This also happens in MFC. I don't know if this matters but I am using VC++ 6.0 professional with no service packs - maybe this is the problem

          T 1 Reply Last reply
          0
          • J Jim Crafton

            Well first off I'm not using MFC though I did a test and the same thign happens. I have sub classed the listview control, and in my WndProc the WM_LBUTTONUP does not get called except under odd circumstances as described in the KB articles. For example - I can click on another window, drag the mouse ovwer the list view, and then release, and then I get a WM_LBUTTONUP, but just a press and release of the mouse on the listview control does not send a WM_LBUTTONUP. If I set the LVS_SINGLESEL style bit then I do get WM_LBUTTONUP as long as I dont click on any item. This is very weird ? This also happens in MFC. I don't know if this matters but I am using VC++ 6.0 professional with no service packs - maybe this is the problem

            T Offline
            T Offline
            Tomasz Sowinski
            wrote on last edited by
            #5

            I'm afraid service packs are not a issue here. The problem exists deep inside comctl32.dll, where list control wndproc lives. From the "Default List View Message Processing" in MSDN: "WM_LBUTTONDOWN: Processed in different ways depending on whether a click or drag operation is being initiated. To determine which operation is involved, the list view control enters a modal message loop until either the button is released or the mouse is moved. [...] If dragging begins over the window background, the list view control enters another modal message loop, enabling the user to form a rectangle by dragging the mouse. Items within the rectangle are selected." The keywords are "modal message loop" - listctrl wndproc uses its own GetMessage/TranslateMessage/DispatchMessage loop, which you can't override - seems that you'll need a hook. Tomasz Sowinski -- http://www.shooltz.com.pl

            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