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. CDialog wipes out when switching to a different application

CDialog wipes out when switching to a different application

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

    I have a VC++ app that uses a progress dialog that contains a CProgressCtrl to indicate progress of a task. When the app kicks of a task, this dialog is launched as a modal dialog and progress of the task is indicated by the CProgressCtrl. Issue ----- For tasks that take extended period of time, the progress dialog blanks out (becomes a blank white rectangle) as soon as user selects a different app. But the processing continues as usual. The dialog is closed when the task is completed. Users are getting confused by this behavior since they are not sure if the app went into an infinite loop or is processing normally since there is no indication of progress in the dialog. They just have to give it time or kill it. I am trying to figure out how to maintain the progress indication in this dialog irrespective of user switching apps. Any suggestions are very much appreciated. So far, I tried the following, based on posts in this board, without success. 1. Force the dialog to stay on top of all windows in the desktop by including the following statement in OnInitDialog SetWindowPos(&this->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 2. Calling a Refresh function in the dialog, containing the following statements, periodically during the progression of the task SetForegroundWindow(); SetFocus();

    S S 2 Replies Last reply
    0
    • B bxveer

      I have a VC++ app that uses a progress dialog that contains a CProgressCtrl to indicate progress of a task. When the app kicks of a task, this dialog is launched as a modal dialog and progress of the task is indicated by the CProgressCtrl. Issue ----- For tasks that take extended period of time, the progress dialog blanks out (becomes a blank white rectangle) as soon as user selects a different app. But the processing continues as usual. The dialog is closed when the task is completed. Users are getting confused by this behavior since they are not sure if the app went into an infinite loop or is processing normally since there is no indication of progress in the dialog. They just have to give it time or kill it. I am trying to figure out how to maintain the progress indication in this dialog irrespective of user switching apps. Any suggestions are very much appreciated. So far, I tried the following, based on posts in this board, without success. 1. Force the dialog to stay on top of all windows in the desktop by including the following statement in OnInitDialog SetWindowPos(&this->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 2. Calling a Refresh function in the dialog, containing the following statements, periodically during the progression of the task SetForegroundWindow(); SetFocus();

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

      http://www.codeproject.com/KB/miscctrl/progresswnd.aspx[^] Check for modal progress bar.

      -@SuDhIrKuMaR@-

      B 1 Reply Last reply
      0
      • B bxveer

        I have a VC++ app that uses a progress dialog that contains a CProgressCtrl to indicate progress of a task. When the app kicks of a task, this dialog is launched as a modal dialog and progress of the task is indicated by the CProgressCtrl. Issue ----- For tasks that take extended period of time, the progress dialog blanks out (becomes a blank white rectangle) as soon as user selects a different app. But the processing continues as usual. The dialog is closed when the task is completed. Users are getting confused by this behavior since they are not sure if the app went into an infinite loop or is processing normally since there is no indication of progress in the dialog. They just have to give it time or kill it. I am trying to figure out how to maintain the progress indication in this dialog irrespective of user switching apps. Any suggestions are very much appreciated. So far, I tried the following, based on posts in this board, without success. 1. Force the dialog to stay on top of all windows in the desktop by including the following statement in OnInitDialog SetWindowPos(&this->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); 2. Calling a Refresh function in the dialog, containing the following statements, periodically during the progression of the task SetForegroundWindow(); SetFocus();

        S Offline
        S Offline
        Saurabh Garg
        wrote on last edited by
        #3

        I guess your application is single threaded and that is the problem. Once you enter in a function which takes long time GUI cannot be updated since there is only one thread and it is busy in the expensive function. The solution is to create another thread and do the processing in that thread. -Saurabh

        B 1 Reply Last reply
        0
        • S Saurabh Garg

          I guess your application is single threaded and that is the problem. Once you enter in a function which takes long time GUI cannot be updated since there is only one thread and it is busy in the expensive function. The solution is to create another thread and do the processing in that thread. -Saurabh

          B Offline
          B Offline
          bxveer
          wrote on last edited by
          #4

          Thank you. Can you refer to any topics in this board that would help triggering my functions in a different thread. I have not done any multi-threaded apps as yet.

          1 Reply Last reply
          0
          • S sudhir_Kumar

            http://www.codeproject.com/KB/miscctrl/progresswnd.aspx[^] Check for modal progress bar.

            -@SuDhIrKuMaR@-

            B Offline
            B Offline
            bxveer
            wrote on last edited by
            #5

            Thank you for the link but it does not solve my issue.

            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