Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Missing WM_MOUSEMOVE from list control when scrolling.

109 views
Skip to first unread message

Mathieu Brault

unread,
Apr 4, 2003, 11:45:20 AM4/4/03
to
I am writing a derived CListCtrl. I paint over the border in by
catching WM_NCPAINT and now I want to paint over the scrollbars as
well to give them a more modern look. I know that the scrollbars
inside the list control are not actual scrollbars but only a cosmetic
paint in the non-client area. This is where I want to paint over. I
intercept WM_NCPAINT, WM_HSCROLL, WM_VSROLL, ... and paint the
non-client area myself.

I have succeeded sor far. My scrollbar is always painted the way I
want, except for one time. When I click on the scollbar's thumb and
start tracking (dragging) it, it will paint the default windows gray
scrollbar channel and thumb.

I looked with Spy++ and here is what I saw:

- When I left click on the scrollbar's thumb, the list control sens a
WM_NCLBUTTONDOWN, a WM_VSCROLL and a WM_CAPTURECHANGED.

- Then when I move the mouse, it will post WM_MOUSEMOVE that my
WindowProc will not catch. If I scroll enough to make the list scroll
by one item, I get the WM_VSCROLL, handle the paint and it's fine.
It's those "Damn" posted WM_MOUSEMOVE that I can't get a hold off. I
checked in Spy++ and the parent window does not get the message
either.

The best way to reproduce this is by clicking the scrollbar and moving
the mouse pointer far away from the list control to the right so it
doesn't scroll anymore. At that time, in Spy++, the only messages you
will see while moving the mouse will be posted WM_MOUSEMOVE (but never
received).

My guess is that when you start to drag the scrollbar and the mouse
capture is taken by the list control, somehow it never receives the
WM_MOUSEMOVE message. Could it be because the original click was in
the non client area? Or better, in the scrollbar portion of the
non-client area?

Can you help? If I fix this, my controls will look good all the time
:)

David Lowndes

unread,
Apr 4, 2003, 2:07:02 PM4/4/03
to
>My guess is that when you start to drag the scrollbar and the mouse
>capture is taken by the list control

That's what I'd assume too.

Could you install a message hook and handle the message there?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq

Mathieu Brault

unread,
Apr 4, 2003, 2:58:39 PM4/4/03
to
I guess. How do I do that?

"David Lowndes" <dav...@mvps.org> wrote in message
news:2tlr8v8mg6ight7g9...@4ax.com...

David Lowndes

unread,
Apr 6, 2003, 6:06:01 AM4/6/03
to
>> Could you install a message hook and handle the message there?
>I guess. How do I do that?

Use the SetWindowsHookEx API. I think WH_MSGFILTER or WH_GETMESSAGE
are what you'll need. Also, have a look at the article "Win32 Hooks"
in MSDN.

Mathieu Brault

unread,
Apr 7, 2003, 8:56:16 AM4/7/03
to
Thanks a lot. I tried it and everything works great!

Finally window controls with a new look, very little code and while keeping
a great OO design.

Keep on the good work guys. I'll drink one for you tonight David :)


"David Lowndes" <dav...@mvps.org> wrote in message

news:6puv8v8q4814o41tq...@4ax.com...

0 new messages