Using ShellExecute or CreateProcess caller lose its focus
-
My intention was to show you a solution that differs from your current implementation and pointing to the fact that you block the message loop. You must not call
WaitForSingleObject
from within your main thread to ensure that the window is repainted (e.g. when moving another window over the application window). That will solve the problem of paint corruption and might also solve your other problems. Overall I think I must shout: Don't use WaitForSingleObject from within your main GUI thread; especially with long wait times! I (like most others here) will not download a complete project and build it. Especially in this case where it must be tested with XP too. -
Yes, I see. But try it in the following order: EnableWindow SetForegroundWindow SetActiveWindow BringWindowToTop
-
No. That is similar (it can just wait for more events). Don't use any blocking wait (or more general: any function that may block for long intervals) from within the main GUI thread. As already suggested you might use a worker thread.
-
No. That is similar (it can just wait for more events). Don't use any blocking wait (or more general: any function that may block for long intervals) from within the main GUI thread. As already suggested you might use a worker thread.
-
Yes, I see. But try it in the following order: EnableWindow SetForegroundWindow SetActiveWindow BringWindowToTop
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
-
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
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.
-
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.
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
-
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
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.
-
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
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.
-
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.