Getting a WM_LBUTTONUP in a listview
-
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
-
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
-
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
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
-
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
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
-
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
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