Click here to Skip to main content
15,885,244 members
Articles / Desktop Programming / ATL
Article

ATL Rotary Control

Rate me:
Please Sign up or sign in to vote.
2.93/5 (6 votes)
25 Jan 2000 119K   1.7K   28   18
A rotary knob similar to that used in the Windows 2000 CD Player
  • Download source files - 67 Kb
  • Sample Image - rotary.gif

    This is an example of a simple ATL rotary control. The control is a copy of the rotary knob found on the Windows 2000 CD Player.

    The control uses a minimum and maximum value, the position is calculation using the following calculated: once the limits are reached).

    double a = -PI/4 + 3*PI/2 * (m_iMax - m_iPos)/(m_iMax - m_iMin);

    The calculation sets the minimum stop at 8 o’clock and the maximum stop is a 4 o’clock. One enhancement that could be made to the project, is the facility for a Jogger button (A button that spins 360 Degrees) increasing a value until the minimum/maximum value is reached (the button still spins, but the value remains the same.

    When the dial is moved a connection point event is fired:

    DialChanged(int nPos)

    This can be picked up in MFC, HTML page, or Visual Basic. The following methods are supported for retrieving and altering the limits and position are:

    [propget, id(1), helpstring("property DialPosition")] HRESULT DialPosition([out, retval] short *pVal);
    
    [propput, id(1), helpstring("property DialPosition")] HRESULT DialPosition([in] short newVal);
    
    [id(2), helpstring("method SetMax")] HRESULT SetMax([in] short nMax);
    
    [id(3), helpstring("method SetMin")] HRESULT SetMin([in] short nMin);

    Any circular bitmap can be using for the background. When the left mouse button is press the LED positional indicator pulses.

    The control has been tested with IE 5.0, Visual Basic 6.0 and MFC. One other thing to mention is that it would be rather simple to port this as MFC based CWnd class, as this how it was developed in the first place.

    License

    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


    Written By
    Software Developer (Senior) Software Kinetics
    United Kingdom United Kingdom




    Software Kinetics
    are experts in developing customised and bespoke applications and have expertise in the development of desktop, mobile and internet applications on Windows.


    We specialise in:

    • User Interface Design
    • Desktop Development
    • Windows Phone Development
    • Windows Presentation Framework
    • Windows Forms
    • Windows Communication Framework
    • Windows Services
    • Network Applications
    • Database Applications
    • Web Development
    • Web Services
    • Silverlight
    • ASP.net


    Visit Software Kinetics

    Comments and Discussions

     
    QuestionSkinnable? Pin
    Heath Stewart15-Jul-03 5:51
    protectorHeath Stewart15-Jul-03 5:51 
    GeneralImplemetation problem Pin
    Member 1665315-Jun-03 23:24
    Member 1665315-Jun-03 23:24 
    GeneralRe: Implemetation problem Pin
    Heath Stewart15-Jul-03 5:47
    protectorHeath Stewart15-Jul-03 5:47 
    GeneralControl dissapears Pin
    23-Feb-02 12:38
    suss23-Feb-02 12:38 
    GeneralRe: Control dissapears Pin
    26-Feb-02 12:18
    suss26-Feb-02 12:18 
    GeneralRe: Control dissapears Pin
    NormDroid1-Nov-02 3:05
    professionalNormDroid1-Nov-02 3:05 
    GeneralMFC sample program Pin
    20-Feb-02 8:19
    suss20-Feb-02 8:19 
    GeneralGreat but ... Pin
    Djibril13-Jan-02 22:13
    professionalDjibril13-Jan-02 22:13 
    GeneralRe: Great but ... Pin
    NormDroid15-Jan-02 21:05
    professionalNormDroid15-Jan-02 21:05 
    GeneralRe: Great but ... Pin
    Djibril15-Jan-02 22:48
    professionalDjibril15-Jan-02 22:48 
    GeneralRe: Great but ... Pin
    NormDroid18-Jan-02 2:12
    professionalNormDroid18-Jan-02 2:12 
    GeneralAlso Linker Error Please Help Pin
    25-Jul-01 20:32
    suss25-Jul-01 20:32 
    GeneralRe: Also Linker Error Please Help Pin
    NormDroid25-Jul-01 21:12
    professionalNormDroid25-Jul-01 21:12 
    Generallinker errors Pin
    Gregory Franz7-Mar-00 9:45
    sussGregory Franz7-Mar-00 9:45 
    GeneralRe: linker errors Pin
    4-Mar-02 23:12
    suss4-Mar-02 23:12 
    GeneralRe: linker errors Pin
    almighty1-Nov-02 2:27
    almighty1-Nov-02 2:27 
    Questionhow do i view the control in the demo? Pin
    -29-Jan-00 2:25
    -29-Jan-00 2:25 
    AnswerRe: how do i view the control in the demo? Pin
    harrisonkirk25-Oct-05 9:46
    harrisonkirk25-Oct-05 9:46 

    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.