Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8501737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:17:31+00:00 2026-06-11T01:17:31+00:00

Is any way to catch events when ListView begins vertical scrolling and ends it?

  • 0

Is any way to catch events when ListView begins vertical scrolling and ends it?
First of all I tried to catch LVN_BEGINSCROLL and LVN_ENDSCROLL notifications, but the result not justified what I expected. Maybe I was wrong trying to handle these notifications (in parent form I handled WM_NOTIFY message and in it’s handler I checked Msg.NMHdr.code).
Also I tried to handle WM_VSCROLL message of my ListView and checked ScrollCode = SB_ENDSCROLL. But how to detect BeginScroll event?
And when I scrolling ListView by mouse wheel WM_VSCROLL does not come. WM_MOUSEWHEEL messages comes instead. How to detect and handle events what I need with WM_MOUSEWHEEL message? Is it possible by checking delta, that is is high-order word in wParam of WM_MOUSEWHEEL message?

Or what can I do?
Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:17:32+00:00Added an answer on June 11, 2026 at 1:17 am

    LVN_BEGINSCROLL and LVN_ENDSCROLL work fine for me when I try them, provided the app has XP themes enabled since they only work with ComCtrl32 v6. But their timing is different than you are expecting, which is likely what is confusing you.

    WM_VSCROLL by itself will work better for what you need, and it does not rely on ComCtl32 v6. It will also handle mouse wheel scrolling, though the timing of wheel begin/end scroll notifications will act more like the LVN_BEGINSCROLL and LVN_ENDSCROLL notifications since a wheel has no idea when the next movement will occur, so each tick of the wheel is treated independantly.

    When using WM_VSCROLL, you can use a boolean variable to keep track of the scrolling state so you can detect the BeginScroll, and then the message will notify you of EndScroll.

    Try this:

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics,
      Controls, Forms, Dialogs, ComCtrls;
    
    type
      TForm1 = class(TForm)
        ListView1: TListView;
        procedure FormCreate(Sender: TObject);
      private
        { Private declarations }
        IsScrolling: Boolean;
        PreviousWndProc: TWndMethod;
        procedure ListViewWndProc(var Message: TMessage);
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    uses
      Commctrl;
    
    {$R *.dfm}
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      PreviousWndProc := ListView1.WindowProc;
      ListView1.WindowProc := ListViewWndProc;
    end;
    
    procedure TForm1.ListViewWndProc(var Message: TMessage);
    {
    type
      NMLVSCROLL = record
        hdr: NMHDR;
        dx: Integer;
        dy: Integer;
      end;
      LPNMLVSCROLL = ^NMLVSCROLL;
    }
    begin
      PreviousWndProc(Message);
      case Message.Msg of
        {
        CN_NOTIFY:
        begin
          case TWMNotify(Message).NMHdr^.code of
            LVN_BEGINSCROLL:
            begin
              if not IsScrolling then
              begin
                IsScrolling := True;
                // do something...
                // use LPNMLVSCROLL(Message.LParam) if needed...
              end;
            end;
            LVN_ENDSCROLL:
            begin
              if IsScrolling then
              begin
                IsScrolling := False;
                // do something...
                // use LPNMLVSCROLL(Message.LParam) if needed...
              end;
            end;
          end;
        end;
        }
        WM_VSCROLL:
        begin
          if TWMVScroll(Message).ScrollCode = SB_ENDSCROLL then
          begin
            if IsScrolling then
            begin
              IsScrolling := False;
              // do something...
            end;
          end
          else if not IsScrolling then
          begin
            IsScrolling := True;
            // do something...
          end;
        end;
      end;
    end;
    
    end.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Java, is there any way to get (catch) all exceptions instead of catching
Is there any way to catch increment and decrement events for dijit.form.NumberSpinner when user
Is there any way to catch key combination ctrl + x + return in
Is there any way I could catch any uncaught exception in javascript? I mean,
Is there any particular way to integrate Captch code validation in iPhone application? is
Any way to realize emacs keybind on Qt Creator (QTC)? Some possibilities: emacskeys but
Any way to declare a new variable in F# without assigning a value to
Any way to make train() run with custom train/test partitions of the data? I'm
Any way to get a dash as part of a property name in C#?
Any way to access a nested form_bulder.object? ## controller @project = Project.new @project.tasks.build form_for(@project)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.