|
WinExec, ShellExec, systerm or CreateProcess ..
None of them working for initial directory and create a bat file in run time and run it..
alex 님이 쓰신 글 :
: This process shoul be start from certain directory but this is not working ..
: Anything wrong??
:
:
: BOOL CreateProcess(
: LPCTSTR lpApplicationName,
: LPTSTR lpCommandLine,
: LPSECURITY_ATTRIBUTES lpProcessAttributes,
: LPSECURITY_ATTRIBUTES lpThreadAttributes,
: BOOL bInheritHandles,
: DWORD dwCreationFlags,
: LPVOID lpEnvironment,
: LPCTSTR lpCurrentDirectory, //**this
: LPSTARTUPINFO lpStartupInfo,
: LPPROCESS_INFORMATION lpProcessInformation
: );
:
: //**this should be the start directory but it does work for me..
:
: char buffer[546];
: sprintf(buffer, "\"%s\" \"%s\"", sPath.c_str(), m_sDumpscript.c_str() );
:
: char dir[546];
: sprintf(dir, "\"%s\"", edtDataDir->Text.c_str());
:
: //this should run on Data directory
: // Start the child process.
: BOOL bResult = CreateProcess( NULL, // No module name (use command line).
: buffer, // Command line.
: NULL, // Process handle not inheritable.
: NULL, // Thread handle not inheritable.
: FALSE, // Set handle inheritance to FALSE.
: 0, // No creation flags.
: NULL, // Use parent's environment block.
: dir, // Use parent's starting directory.
: &si, // Pointer to STARTUPINFO structure.
: &pi ) ; // Pointer to PROCESS_INFORMATION structure.
|