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 perform something after dialog is initialized and displayed.

How to perform something after dialog is initialized and displayed.

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
7 Posts 5 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.
  • T Offline
    T Offline
    TPN
    wrote on last edited by
    #1

    Hi all, I want to perform file copy operations and display a progress-bar after my dialog has just been initialized and displayed with out any user action such as clicking on a button... However I cannot put that codes in the OnInitDialog() virtual function of that dialog. If I do that, the dialog will appear after all operations are ended. Please help to show me how to do that. Thanks in advance.

    S K D 3 Replies Last reply
    0
    • T TPN

      Hi all, I want to perform file copy operations and display a progress-bar after my dialog has just been initialized and displayed with out any user action such as clicking on a button... However I cannot put that codes in the OnInitDialog() virtual function of that dialog. If I do that, the dialog will appear after all operations are ended. Please help to show me how to do that. Thanks in advance.

      S Offline
      S Offline
      Sameer_Thakur
      wrote on last edited by
      #2

      Hi. U r requirement is to display this progress only when user starts the file transfer operation say by clicking on any button. You can take the following approach... 1. Add the Progress at the time of Layouting your dialog box. 2. Keep that progress bar invisible. 3. When user starts file transfer process; make that progress bar visible. U can use CWnd::ShowWindow(TRUE/FALSE) to show and hide perticular control.

      Sameer Thakur

      T 1 Reply Last reply
      0
      • T TPN

        Hi all, I want to perform file copy operations and display a progress-bar after my dialog has just been initialized and displayed with out any user action such as clicking on a button... However I cannot put that codes in the OnInitDialog() virtual function of that dialog. If I do that, the dialog will appear after all operations are ended. Please help to show me how to do that. Thanks in advance.

        K Offline
        K Offline
        krmed
        wrote on last edited by
        #3

        One easy way would be to set a timer (SetTimer) in your OnInitDialog and in the handler for the timer, kill the timer and start your copy process. You could probably get away with just a 10-20 millisecond setting for the timer. Hope that helps.

        Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

        1 Reply Last reply
        0
        • T TPN

          Hi all, I want to perform file copy operations and display a progress-bar after my dialog has just been initialized and displayed with out any user action such as clicking on a button... However I cannot put that codes in the OnInitDialog() virtual function of that dialog. If I do that, the dialog will appear after all operations are ended. Please help to show me how to do that. Thanks in advance.

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

          The way I've always done this is to post a user-defined message right before OnInitDialog() returns. In your handler for that message, do your processing.


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          T L 2 Replies Last reply
          0
          • S Sameer_Thakur

            Hi. U r requirement is to display this progress only when user starts the file transfer operation say by clicking on any button. You can take the following approach... 1. Add the Progress at the time of Layouting your dialog box. 2. Keep that progress bar invisible. 3. When user starts file transfer process; make that progress bar visible. U can use CWnd::ShowWindow(TRUE/FALSE) to show and hide perticular control.

            Sameer Thakur

            T Offline
            T Offline
            TPN
            wrote on last edited by
            #5

            Thank you, Sameer_Thakur. I just only want to start the file transfer operation automatically after the dialog box is displayed (exactly after OnInitDialog() called) without clicking any button, without any user action. Thank you.

            1 Reply Last reply
            0
            • D David Crow

              The way I've always done this is to post a user-defined message right before OnInitDialog() returns. In your handler for that message, do your processing.


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              T Offline
              T Offline
              TPN
              wrote on last edited by
              #6

              Thank you DavidCrow. I think your sugesstion is better than using a timer, because using a timer looks manually and not reliable. But I don't think that Windows doesn't support this situation. Once again, thank you.

              1 Reply Last reply
              0
              • D David Crow

                The way I've always done this is to post a user-defined message right before OnInitDialog() returns. In your handler for that message, do your processing.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Very nice :cool:

                Why is common sense not common? Never argue with an idiot. They will drag you down to their level where they are an expert. Sometimes it takes a lot of work to be lazy

                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