
Tech TipsCreateProcessThe Task is to start a batch file (from inside a program) and supply some paths for further handling. It is suggested, you use the function CreateProcess and that you quote the paths, which include spaces. Following is the call syntax of this function. The (in)complete description can be found here and a supplement in Microsoft Knowledge Base Article - 175986 BOOL CreateProcess(
LPCTSTR lpApplicationName, // pointer to name of executable module
LPTSTR lpCommandLine, // pointer to command line string
LPSECURITY_ATTRIBUTES lpProcessAttributes, // pointer to process security attributes
LPSECURITY_ATTRIBUTES lpThreadAttributes, // pointer to thread security attributes
BOOL bInheritHandles, // handle inheritance flag
DWORD dwCreationFlags, // creation flags
LPVOID lpEnvironment, // pointer to new environment block
LPCTSTR lpCurrentDirectory, // pointer to current directory name
LPSTARTUPINFO lpStartupInfo, // pointer to STARTUPINFO
LPPROCESS_INFORMATION lpProcessInformation // pointer to PROCESS_INFORMATION
);
TestsThe test focuses on the batch file "path0\Prog.bat", where path0 is e.g. c:\Programs\Company with Programs and Company substituted accordingly. Test results:
1) If you think in C, you must escape sepcial
characters to generate these strings! Workaround:
Tests were conducted on MS Windows NT 4 SR6a and MS Windows XP Home SR1 on 2003-10-17. Behavier and embedded links are subject to changes by MS (Microsoft)! |
|||||||||||||||||||||||||||||||||||||
|
|
Copyright 2008 © EnCoCo - All Rights Reserved