|
|
|
date: Tue, 9 Sep 2008 16:11:08 -0400,
group: microsoft.public.dotnet.framework.windowsforms
back
Re: Unable to detect WM_VSCROLL in C#
On 9 Sep, 21:11, "Robert Linder" wrote:
> Hello,
>
> I need to detect WM_VSCROLL on a ListView. I am able to see the messages
> on "Microsoft Spy', but when I use the below code, I do not see
> WM_VSCROLL.
>
> I am using VS2008 SP1 on XP SP3.
>
> protected override void WndProc(ref Message message)
> {
> const int WM_VSCROLL = 0x0115;
> switch (message.Msg)
> {
> case WM_VSCROLL:
> Console.WriteLine(" " message);
> base.WndProc(ref message);
> break;
> default:
> Console.WriteLine(message);
> base.WndProc(ref message);
> break;
> }
> }
>
> These are the message when I use the scroll bar ^ and v buttons, using the
> above code:
> msg=0x210 (WM_PARENTNOTIFY) hwnd=0xd0b5c wparam=0x201 lparam=0x5901de
> (WM_LBUTTONDOWN) result=0x0
> msg=0x21 (WM_MOUSEACTIVATE) hwnd=0xd0b5c wparam=0x240c60 lparam=0x2010007
> result=0x0
> msg=0x20 (WM_SETCURSOR) hwnd=0xd0b5c wparam=0x1a0c98 lparam=0x2010007
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bd234
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc744
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc35c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc744
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc35c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc35c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bc79c
> result=0x0
> msg=0x4e (WM_NOTIFY) hwnd=0xd0b5c wparam=0x220aec lparam=0x43bd234
> result=0x0
>
> Thanks,
> Robert
That is how it should go.
Are you overriding WndProc in the form itself? Or in the listview?
You would need to extend the listview class and override WndProc from
within there - then WM_VSCROLL should be picked up.
If you have overridden it in the main Form itself, then that would
explain it. The message only gets sent to the listbox and that will
just trigger some other events on the form..
Off the top of my head I cannot remember if a ListView actualy has an
OnScroll Event, which would certainly make things simpler. Some
controls do, not sure about listbox/view though
date: Wed, 10 Sep 2008 05:42:43 -0700 (PDT)
author: James
|
|