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. Running a function as the dialog starts

Running a function as the dialog starts

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++tutorial
6 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.
  • C Offline
    C Offline
    carrie
    wrote on last edited by
    #1

    Hey, Probably a stupid question but how do I get a function to run after the dialog has loaded? The situation is I'm writing a mp3->wav converter where a dialog should load up with a progress bar and a couple of static text labels. I just want it to load the dialog then run the Decompress function without any user input at all. Putting the function call in initInstance just runs it before the dialog has loaded, and putting it in the constructor for the Dialog is causing an error in wincore.cpp. Any ideas how to fix this silly problem? thanks guys :)

    S M 2 Replies Last reply
    0
    • C carrie

      Hey, Probably a stupid question but how do I get a function to run after the dialog has loaded? The situation is I'm writing a mp3->wav converter where a dialog should load up with a progress bar and a couple of static text labels. I just want it to load the dialog then run the Decompress function without any user input at all. Putting the function call in initInstance just runs it before the dialog has loaded, and putting it in the constructor for the Dialog is causing an error in wincore.cpp. Any ideas how to fix this silly problem? thanks guys :)

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      just show the dialog, don't call DoModal.


      Back to real work : D-21.

      C 1 Reply Last reply
      0
      • S Stephane Rodriguez

        just show the dialog, don't call DoModal.


        Back to real work : D-21.

        C Offline
        C Offline
        carrie
        wrote on last edited by
        #3

        I'm not too sure what you're meaning I'm afraid. I got it wrong in my first post, I was called the dialogs initDialog() and not the initinstance function. do you mean changing the int nResponse = dlg.DoModal(); line in the app class? I tried changing that to dlg.ShowWindow(SW_SHOWNORMAL) but its giving errors :( Sorry to be a pain in the ass about this and thanks for your help

        S 1 Reply Last reply
        0
        • C carrie

          I'm not too sure what you're meaning I'm afraid. I got it wrong in my first post, I was called the dialogs initDialog() and not the initinstance function. do you mean changing the int nResponse = dlg.DoModal(); line in the app class? I tried changing that to dlg.ShowWindow(SW_SHOWNORMAL) but its giving errors :( Sorry to be a pain in the ass about this and thanks for your help

          S Offline
          S Offline
          Stephane Rodriguez
          wrote on last edited by
          #4

          You've got plenty of modeless dialog code snippets on CodeProject to play with.


          Back to real work : D-21.

          1 Reply Last reply
          0
          • C carrie

            Hey, Probably a stupid question but how do I get a function to run after the dialog has loaded? The situation is I'm writing a mp3->wav converter where a dialog should load up with a progress bar and a couple of static text labels. I just want it to load the dialog then run the Decompress function without any user input at all. Putting the function call in initInstance just runs it before the dialog has loaded, and putting it in the constructor for the Dialog is causing an error in wincore.cpp. Any ideas how to fix this silly problem? thanks guys :)

            M Offline
            M Offline
            Michael Dunn
            wrote on last edited by
            #5

            Pick a command ID, such as 100, then at the end of OnInitDialog(), call

            PostMessage ( WM_COMMAND, 100 );

            Add a handler for that command ID to the dialog, and do the conversion in that handler. --Mike-- "alyson hannigan is so cute it's crazy" -- Googlism Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

            C 1 Reply Last reply
            0
            • M Michael Dunn

              Pick a command ID, such as 100, then at the end of OnInitDialog(), call

              PostMessage ( WM_COMMAND, 100 );

              Add a handler for that command ID to the dialog, and do the conversion in that handler. --Mike-- "alyson hannigan is so cute it's crazy" -- Googlism Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click! My really out-of-date homepage Sonork-100.19012 Acid_Helm

              C Offline
              C Offline
              carrie
              wrote on last edited by
              #6

              Fantastic, thanks guys. I think my heads still stuck somewhere painful after my birthday drinks last night :)

              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