Click here to Skip to main content
13,451,389 members (50,764 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked
Posted 23 Jan 2001

CTimerScroll class

Rate this:
Please Sign up or sign in to vote.
Helper class to handler the mouse cursor movement near to client's area borders
<!-- Link to source file download -->
  • Download source files - 3 Kb
  • <!-- Link to demo file download -->
  • Download demo project - 31 Kb
  • <!-- Article image -->

    Sample Image - TimerScroll.gif

    <!-- Add the rest of your HTML here -->


    This class is useful for scrolling CWnd derived objects, for example CScrollView, and helps you to handle mouse cursor movement near the client's border. The CTimerScroll object sends WM_HSCROLL and WM_VSCROLL messages to your object.

    It has only 3 methods:

    1. Register(CWnd* pWnd) - Registers the windows object to send messages to.
    2. Install() - Installs the timer and captures the mouse cursor
    3. Unistall() - Helper method to unistall the timer.

    How to use

    1. Insert a CTimerScroll object in your CWnd derived class.
    2. Invoke Register in your init creation process. For example OnInitialUpdate, OnCreate, ....
    3. In the OnLButtonDown message handler, call Install(), this method capture the mouse for you.
    4. In the OnLButtonUp message handler, call ReleaseCapture, to release the mouse. This unistall the timer automatically.

    Of course you must handle the scrolling messages.

    Sample code

    The TSSample sample is a MFC SDI VC++6 aplication sample, and uses the CTimerScroll. The TSSampleView is derived from CScrollView (this MFC class have scroll handler methods build in).


    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    About the Author

    José Alfredo Morón P.
    Systems Engineer
    Venezuela Venezuela
    No Biography provided

    You may also be interested in...

    Comments and Discussions

    GeneralProblems Pin
    Anonymous8-Mar-02 17:37
    memberAnonymous8-Mar-02 17:37 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Terms of Use | Mobile
    Web04-2016 | 2.8.180318.3 | Last Updated 24 Jan 2001
    Article Copyright 2001 by José Alfredo Morón P.
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid