I am working on a legacy application which calls CreateProcess method
method1()
{
BOOL bResult = ::CreateProcess(
NULL, // LPCTSTR
wctAppPath, // LPTSTR lpszCommandLine
NULL, // LPSECURITY_ATTRIBUTES lpsaProc
NULL, // LPSECURITY_ATTRIBUTES lpsaThread
FALSE, // BOOL fInheritHandles
NULL, // DWORD fdwCreate
NULL, // LPVOID lpvEnvironment
NULL, // LPCTSTR lpszCurDir
&stStatusInfo, // LPSTARTUPINFO lpsiStartInfo
&stProcInfo // LPPROCESS_INFORMATION lppiProcInfo
);
}
wctAppPath value : (folderPath\test.bat ..\excel.xls) this CreateProcess trigger bat file that will launch vbscript and passed excel file is modified.
Once this method1() ends, they are calling CreateProcess() again in method2() to open the same excel file.
method2()
{
BOOL bResult = ::CreateProcess(
NULL, // LPCTSTR
wctAppPath, // LPTSTR
NULL, // LPSECURITY_ATTRIBUTES lpsaProc
NULL, // LPSECURITY_ATTRIBUTES lpsaThread
FALSE, // BOOL fInheritHandles
NULL, // DWORD fdwCreate
NULL, // LPVOID lpvEnvironment
NULL, // LPCTSTR lpszCurDir
&stStatusInfo, // LPSTARTUPINFO lpsiStartInfo
&stProcInfo // LPPROCESS_INFORMATION lppiProcInfo
);
}
Here wctAppPath is (excelInstallationPath\EXCEL.exe folderPath\excelFile.xls)
Once all the main function ends, the required modified excel in stored in Documents folder not in the actual given path. Actual given excel is not modified at all.
I have commented the method2 and tried. Expected excel appears in given path.
Legacy application is CATIA. In V5, CATScriptUtilities::ExecuteScript is used to call catvba. In V6, we can use the same API to call catvba. It works fine. There is no need to call .bat->.vba->.catvba