Hi,
I have a loader application which starts a perl script in a hidden window (do db backup an temporary files clear), wait the script which is a console app to finish, then start my main MFC app. I'm using Windows XP. The script hidden window exec has a strange side effect, my MFC app doesn't have the user focus and is not the active process when loads. How can I get them? Where to get them - inside the MFC app or add some code to the loader? Here is the main part of my loader:
SetEnvironmentVariable("PATH", libpath);
if (0 != strlen(szScriptExecName)) {
ZeroMemory(&si, sizeof(STARTUPINFO));
si.wShowWindow = SW_HIDE;
si.dwFlags = STARTF_USESHOWWINDOW;
if (CreateProcess(szScriptExecName, szScriptParams, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
Sleep(200);
}
}
ZeroMemory(&si, sizeof(STARTUPINFO));
if (CreateProcess(szExecName, cmdLine, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
Note: if I do not exec the script, the MFC apps runs correctly and get the focus.
Stanimir
_______________________________________________ msvc mailing list [EMAIL PROTECTED] See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription changes, and list archive.
