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. closing Messagebox

closing Messagebox

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
4 Posts 4 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.
  • I Offline
    I Offline
    iayd
    wrote on last edited by
    #1

    Hi How can I close a messagebox without using the Mouse?For example I want that the messageBox will close by itself after 10 seconds.Can I do that? Thanks

    T D H 3 Replies Last reply
    0
    • I iayd

      Hi How can I close a messagebox without using the Mouse?For example I want that the messageBox will close by itself after 10 seconds.Can I do that? Thanks

      T Offline
      T Offline
      thammadi
      wrote on last edited by
      #2

      There is no timeout option for a MessageBox API. I would suggest use a dialog box, make it generic enough to be used. Use timer inside the dialog box. something like this: Call SetTimer(1, 10000, NULL) in CMsgBoxDlg::OnInitDialog() method. //10000 for 10 secs In timer method: void CMsgBoxDlg::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default CDialog::OnOK(); CDialog::OnTimer(nIDEvent); } Add a public member function to accept message box string and caption. Use static control to display the provided string on the dialog box with a 'Ok' button. Hope this helps Thammadi

      1 Reply Last reply
      0
      • I iayd

        Hi How can I close a messagebox without using the Mouse?For example I want that the messageBox will close by itself after 10 seconds.Can I do that? Thanks

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        iayd wrote:

        How can I close a messagebox without using the Mouse?

        Spacebar, Alt+F4, Alt+Space then either X or C.

        iayd wrote:

        For example I want that the messageBox will close by itself after 10 seconds.Can I do that?

        Yes. See here.


        "A good athlete is the result of a good and worthy opponent." - David Crow

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        1 Reply Last reply
        0
        • I iayd

          Hi How can I close a messagebox without using the Mouse?For example I want that the messageBox will close by itself after 10 seconds.Can I do that? Thanks

          H Offline
          H Offline
          Hamid Taebi
          wrote on last edited by
          #4

          On the time you can send WM_CLOSE to it.


          WhiteSky


          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