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. Application Startup

Application Startup

Scheduled Pinned Locked Moved C / C++ / MFC
c++designquestion
12 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.
  • R Offline
    R Offline
    Robin Imrie
    wrote on last edited by
    #1

    I have an SDI style (no doc/view) MFC application that has several windows. These the content of these windows take a while to initialise and the net result is that from double clicking the icon to the application apearing takes a long time and makes it apear that it has not been started. I would like the main ui of this application to appear asap and then initialise the processes that take time to get going. Anyone have suggestions how I might be able to achieve this? Robin

    _ D 2 Replies Last reply
    0
    • R Robin Imrie

      I have an SDI style (no doc/view) MFC application that has several windows. These the content of these windows take a while to initialise and the net result is that from double clicking the icon to the application apearing takes a long time and makes it apear that it has not been started. I would like the main ui of this application to appear asap and then initialise the processes that take time to get going. Anyone have suggestions how I might be able to achieve this? Robin

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      You can start the task once the dialog is showing. You can use a thread that would keep on downloading and updating the controls and the data that you need to show in your application, also you can show a progress bar somewhere on the screen of your application that some work is in progress and the user needs to wait until he can work on the application.

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      R 1 Reply Last reply
      0
      • R Robin Imrie

        I have an SDI style (no doc/view) MFC application that has several windows. These the content of these windows take a while to initialise and the net result is that from double clicking the icon to the application apearing takes a long time and makes it apear that it has not been started. I would like the main ui of this application to appear asap and then initialise the processes that take time to get going. Anyone have suggestions how I might be able to achieve this? Robin

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

        Robin Imrie wrote:

        ...from double clicking the icon to the application apearing takes a long time...

        So what are you having the application do?


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

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

        R 1 Reply Last reply
        0
        • _ _AnsHUMAN_

          You can start the task once the dialog is showing. You can use a thread that would keep on downloading and updating the controls and the data that you need to show in your application, also you can show a progress bar somewhere on the screen of your application that some work is in progress and the user needs to wait until he can work on the application.

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          R Offline
          R Offline
          Robin Imrie
          wrote on last edited by
          #4

          My app isn't dialog based! But I assume the technique would be the same for a dialog app and Windowed app. Would I start off my thread from OnShowWindow or OnActivate? (with traps to ensure it dosent get fired more than once)

          1 Reply Last reply
          0
          • D David Crow

            Robin Imrie wrote:

            ...from double clicking the icon to the application apearing takes a long time...

            So what are you having the application do?


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

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

            R Offline
            R Offline
            Robin Imrie
            wrote on last edited by
            #5

            I havent got to the point of working out what is taking up the time but I thint it might have somting to do with the 2 http (aspx) server (one used by the application only and the other for external access only) and displaying of a video file. These are things I want to delay the start up/initialization of.

            D 1 Reply Last reply
            0
            • R Robin Imrie

              I havent got to the point of working out what is taking up the time but I thint it might have somting to do with the 2 http (aspx) server (one used by the application only and the other for external access only) and displaying of a video file. These are things I want to delay the start up/initialization of.

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

              Robin Imrie wrote:

              ...I thint it might have somting to do with the 2 http (aspx) server (one used by the application only and the other for external access only) and displaying of a video file.

              So don't start these things until after the application has fully shown itself.


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

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

              R 1 Reply Last reply
              0
              • D David Crow

                Robin Imrie wrote:

                ...I thint it might have somting to do with the 2 http (aspx) server (one used by the application only and the other for external access only) and displaying of a video file.

                So don't start these things until after the application has fully shown itself.


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

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

                R Offline
                R Offline
                Robin Imrie
                wrote on last edited by
                #7

                This is exactly what I want to do hence the original post... When do I know when the application has fully shown itself?

                D 1 Reply Last reply
                0
                • R Robin Imrie

                  This is exactly what I want to do hence the original post... When do I know when the application has fully shown itself?

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

                  Robin Imrie wrote:

                  When do I know when the application has fully shown itself?

                  That's hard to say since you've removed the doc/view support from it. Do you still have a "main" frame? Has anything replaced the view?


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

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

                  R 1 Reply Last reply
                  0
                  • D David Crow

                    Robin Imrie wrote:

                    When do I know when the application has fully shown itself?

                    That's hard to say since you've removed the doc/view support from it. Do you still have a "main" frame? Has anything replaced the view?


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

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

                    R Offline
                    R Offline
                    Robin Imrie
                    wrote on last edited by
                    #9

                    I do still have a Main frame. The main frame contains a CChildView and this is where all the other visible elements are contained. CChildView inherits CWnd.

                    D 1 Reply Last reply
                    0
                    • R Robin Imrie

                      I do still have a Main frame. The main frame contains a CChildView and this is where all the other visible elements are contained. CChildView inherits CWnd.

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

                      My first guess would be to post a message from CChildView::OnCreate(). In the handler for that message, start your other processing. This is likely to not work, however, if the "other processing" ties up the main thread enough such that it cannot finish rendering the UI.


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

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

                      R 1 Reply Last reply
                      0
                      • D David Crow

                        My first guess would be to post a message from CChildView::OnCreate(). In the handler for that message, start your other processing. This is likely to not work, however, if the "other processing" ties up the main thread enough such that it cannot finish rendering the UI.


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

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

                        R Offline
                        R Offline
                        Robin Imrie
                        wrote on last edited by
                        #11

                        After adding various handlers (WM_ACTIVATE & WM_SHOWWINDOW) which just produce trace statments so I can see the order of events. I have come to the conclussion there there are two ways of tackling this... (could be more!) 1) Start a thread in response to a WM_ACTIVATE (with mechanizm to prevent it from being run a 2nd time). 2) Finish off the initialization from the InitInstance() function in the CWinApp derived class. Do these seem good options? Out of curiosity how could it be done if was using doc/view?

                        D 1 Reply Last reply
                        0
                        • R Robin Imrie

                          After adding various handlers (WM_ACTIVATE & WM_SHOWWINDOW) which just produce trace statments so I can see the order of events. I have come to the conclussion there there are two ways of tackling this... (could be more!) 1) Start a thread in response to a WM_ACTIVATE (with mechanizm to prevent it from being run a 2nd time). 2) Finish off the initialization from the InitInstance() function in the CWinApp derived class. Do these seem good options? Out of curiosity how could it be done if was using doc/view?

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

                          Robin Imrie wrote:

                          Out of curiosity how could it be done if was using doc/view?

                          Probably in the CView::OnUpdate() method.


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

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

                          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