Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CButton Sib-class

CButton Sib-class

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiotutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Grahamfff
    wrote on last edited by
    #1

    I need to start a timer when a button is pressed and then stop the timer when the button is released. I think I need to sub-class CButton as dont have the WM_KEYUP or WM_KEYDOWN events in the CButton class. Can someone point me in the direction of how to sub-class a control in Visual Studio 7.1 please. Many thanks, Graham. grahamfff

    P A 2 Replies Last reply
    0
    • G Grahamfff

      I need to start a timer when a button is pressed and then stop the timer when the button is released. I think I need to sub-class CButton as dont have the WM_KEYUP or WM_KEYDOWN events in the CButton class. Can someone point me in the direction of how to sub-class a control in Visual Studio 7.1 please. Many thanks, Graham. grahamfff

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      http://www.codeproject.com/buttonctrl/autorepeat.asp[^]


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


      Honoured as one of The Most Helpful Members of 2004

      1 Reply Last reply
      0
      • G Grahamfff

        I need to start a timer when a button is pressed and then stop the timer when the button is released. I think I need to sub-class CButton as dont have the WM_KEYUP or WM_KEYDOWN events in the CButton class. Can someone point me in the direction of how to sub-class a control in Visual Studio 7.1 please. Many thanks, Graham. grahamfff

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        write the start timer code and Stop Timer code on the BN_CLICKED event of the button. Change the caption of the button to "STOP TIMER" when the timer starts. Check the caption of the button before branching to the appropriate code.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups