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. Using ShellExecute or CreateProcess caller lose its focus

Using ShellExecute or CreateProcess caller lose its focus

Scheduled Pinned Locked Moved C / C++ / MFC
c++comhelptutorialannouncement
25 Posts 5 Posters 2 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.
  • S sdancer75

    The worker thread does not lock the main app as long as its active. I dont want this. I just want a modal like behaviour and not floating windows all around the desktop.

    sdancer75

    J Offline
    J Offline
    Jochen Arndt
    wrote on last edited by
    #21

    You can disable your app window and/or show a modal dialog while the worker thread is active and re-enable when it finishes. So the message loop is not blocked and repainting is ensured while the app itself is blocked. What do you mean by floating windows? There is no additional window.

    S 1 Reply Last reply
    0
    • J Jochen Arndt

      You can disable your app window and/or show a modal dialog while the worker thread is active and re-enable when it finishes. So the message loop is not blocked and repainting is ensured while the app itself is blocked. What do you mean by floating windows? There is no additional window.

      S Offline
      S Offline
      sdancer75
      wrote on last edited by
      #22

      Quote:

      You can disable your app window and/or show a modal dialog while the worker thread is active and re-enable when it finishes.

      You mean a dummy dialog just to block to main app ?

      Quote:

      What do you mean by floating windows? There is no additional window.

      I mean the two windows that will be active at the same time (main and child) and user will have the ability to work with the both of them.

      sdancer75

      J 1 Reply Last reply
      0
      • S sdancer75

        Quote:

        You can disable your app window and/or show a modal dialog while the worker thread is active and re-enable when it finishes.

        You mean a dummy dialog just to block to main app ?

        Quote:

        What do you mean by floating windows? There is no additional window.

        I mean the two windows that will be active at the same time (main and child) and user will have the ability to work with the both of them.

        sdancer75

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #23

        sdancer75 wrote:

        You mean a dummy dialog just to block to main app ?

        Yes. Or just disable the main window. The dialog can show something like "Please wait until the update is installed".

        sdancer75 wrote:

        I mean the two windows that will be active at the same time (main and child) and user will have the ability to work with the both of them.

        When the app is blocked by disabling or a dialog it can't be moved by the user (the dialog may be moved). So when not using a dialog it is the same behaviour as with your current solution.

        S 1 Reply Last reply
        0
        • S sdancer75

          One last thing. The EnableWindow(xxxx) do the mess in my situation. If I dont use this function I have to process the paint messages from the child window. In this case I think that

          WaitForMultipleObjects

          will do the job in the XP case. Do you agree with this guess ? .... or better i will give it a try right now.

          sdancer75

          V Offline
          V Offline
          Victor Nijegorodov
          wrote on last edited by
          #24

          No, WFMO is the same as WFSO (just waiting for more than one object; however I don't see any additional one in your problem description). The usual way is move waiting in a worker thread to not block the main UI thread.

          1 Reply Last reply
          0
          • J Jochen Arndt

            sdancer75 wrote:

            You mean a dummy dialog just to block to main app ?

            Yes. Or just disable the main window. The dialog can show something like "Please wait until the update is installed".

            sdancer75 wrote:

            I mean the two windows that will be active at the same time (main and child) and user will have the ability to work with the both of them.

            When the app is blocked by disabling or a dialog it can't be moved by the user (the dialog may be moved). So when not using a dialog it is the same behaviour as with your current solution.

            S Offline
            S Offline
            sdancer75
            wrote on last edited by
            #25

            Finally I used MsgWaitForMultipleObjects with message process loop. I avoid to use EnableWindow() function at all. It seems to work fine under Win7. I will take a copy to my work tommorow to test it under XP for paint corruption.

            sdancer75

            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