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. how to enable the "ok" button after 8 second in MFC Dialog box

how to enable the "ok" button after 8 second in MFC Dialog box

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialc++
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.
  • S Offline
    S Offline
    shiva shankar
    wrote on last edited by
    #1

    in my project, when the dialog box (window) is initialized( i,e Onintdialog())the "ok" button is disabled, and i want it to enable automatically after 8 seconds. plz can any one guide me to enable the button after 8 seconds...

    R T 2 Replies Last reply
    0
    • S shiva shankar

      in my project, when the dialog box (window) is initialized( i,e Onintdialog())the "ok" button is disabled, and i want it to enable automatically after 8 seconds. plz can any one guide me to enable the button after 8 seconds...

      R Offline
      R Offline
      Ravi Bhavnani
      wrote on last edited by
      #2

      Create a timer in the OnInitDialog() handler. In the OnTimer() handler, enable the OK button and kill the timer. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

      1 Reply Last reply
      0
      • S shiva shankar

        in my project, when the dialog box (window) is initialized( i,e Onintdialog())the "ok" button is disabled, and i want it to enable automatically after 8 seconds. plz can any one guide me to enable the button after 8 seconds...

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        OnInitDialog() :
        ((CButton*)GetDlgItem(IDOK))->EnableWindow(FALSE);
        SetTimer(100 /* ID=100, for example */, 8000 /* in milliseconds */, NULL /* callback function */);
        //...

        OnTimer(UINT nIDEvent) :
        if (nIDEvent == 100) {
        ((CButton*)GetDlgItem(IDOK))->EnableWindow(TRUE);
        KillTimer(100);
        }


        TOXCCT >>> GEII power

        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