MisterIKS
21st November 2010, 08:55
Hey everybody,
we are developing an updater for our software which is started by each of our products and updates all applications at once. We've nearly finished our updater, and it works perfectly fine if we run thge updaters exe directly, but the way we run the updater from within our products causes trouble.
We're using a QProcess within the Product which starts the updater. The updater himself finds running products and terminates them via
bool TerminateAppEnum(HWND hwnd, LPARAM lParam)
{
DWORD dwID ;
GetWindowThreadProcessId(hwnd, &dwID) ;
if(dwID == (DWORD)lParam)
{
PostMessage(hwnd, WM_CLOSE, 0, 0);
PostMessage(hwnd, WM_QUIT, 0, 0);
}
return true;
}
which was the only way we could find terminating the process safely without killing it.
Now as soon as the updater termintes the product it was started from, the updater himself stops with the common windows-message saying that the application has run into a problem and needs to be stopped.
Now we're shure that this is just because the product is listening to the updater process but we coundn't find a way, not even in WinAPI, that simply starts an exe file without any dependence to of from the product.
The only way we've imagined, anthough we're not satisfied with it, was to dynamically write an batch-file with QFile running the updater with a single command and then run it with QProcess and terminate the process some seconds later and remove the file again.
There must be a better way to do that and we really hope that you know a solution WinAPI or not, that could help us. Thanks in advance!
we are developing an updater for our software which is started by each of our products and updates all applications at once. We've nearly finished our updater, and it works perfectly fine if we run thge updaters exe directly, but the way we run the updater from within our products causes trouble.
We're using a QProcess within the Product which starts the updater. The updater himself finds running products and terminates them via
bool TerminateAppEnum(HWND hwnd, LPARAM lParam)
{
DWORD dwID ;
GetWindowThreadProcessId(hwnd, &dwID) ;
if(dwID == (DWORD)lParam)
{
PostMessage(hwnd, WM_CLOSE, 0, 0);
PostMessage(hwnd, WM_QUIT, 0, 0);
}
return true;
}
which was the only way we could find terminating the process safely without killing it.
Now as soon as the updater termintes the product it was started from, the updater himself stops with the common windows-message saying that the application has run into a problem and needs to be stopped.
Now we're shure that this is just because the product is listening to the updater process but we coundn't find a way, not even in WinAPI, that simply starts an exe file without any dependence to of from the product.
The only way we've imagined, anthough we're not satisfied with it, was to dynamically write an batch-file with QFile running the updater with a single command and then run it with QProcess and terminate the process some seconds later and remove the file again.
There must be a better way to do that and we really hope that you know a solution WinAPI or not, that could help us. Thanks in advance!