views:

34

answers:

1

Hi,

I have built a GUI interface in C++ (Windows XP, visual c++ 2008). There you can configure some parameters and when I click on the OK button, a silent application is launched (and uses the values setted). When I do this, the GUI frozes and even dissappears if you switch to other windows(it's still there, but you can only see a white space), when the other application's finished the GUI works again.

This is the correct behaviour, I don't want the user to be able to edit the fields... but it's a bit ugly when you can't see the GUI. Does anybody know an easy way of being able to switch to other windows and being able to see the the GUI when you switch back?

Thanks in advance

Edited:

Hi, I tried doing this, but the problem is that to run the apps in background I had a function that uses CreateProcess. So both ways the GUI gets frozen: if I create a Thread that creates the process and if I creathe the process directly.

Then I wait for the process to finish:

if (!CreateProcess( NULL, Args, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &StartupInfo, &ProcessInfo)) { return GetLastError();
} WaitForSingleObject(ProcessInfo.hProcess, INFINITE); if(!GetExitCodeProcess(ProcessInfo.hProcess, &rc)) rc = 0;

Any idea?

A: 

Start the external application in a second thread, and block your main thread via a modal popup. In the modal popup use a timer to regularly check if the second thread has already finished and close it if it has.

As a bonus you could show the time spent in your modal popup.

Patrick