Createprocess in vc++
-
hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }
-
hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }
CreateProcess requires an executable file's path. You may have to use cmd.exe and pass "copy" as the commandline argument.
-
hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }
The process name could be "cmd" and its parameter - "/c copy ..." :)
-
The process name could be "cmd" and its parameter - "/c copy ..." :)
-
hi all I am using copy command in createprocess() but this is not working I am writing following code but this is not working AnsiString cmdpath = "copy /b c:\\000.mp3+c:\\001.mp3 c:\\out.mp3"; PROCESS_INFORMATION pInfo; STARTUPINFOA sInfo; DWORD exitCode; memset (&sInfo, 0, sizeof(sInfo)); sInfo.cb = sizeof(sInfo); sInfo.cb = sizeof(STARTUPINFOA); sInfo.lpReserved = NULL; sInfo.lpReserved2 = NULL; sInfo.cbReserved2 = 0; sInfo.lpDesktop = NULL; sInfo.lpTitle = NULL; sInfo.dwFlags = 0; sInfo.dwX = 0; sInfo.dwY = 0; sInfo.dwFillAttribute = 0; sInfo.wShowWindow = SW_FORCEMINIMIZE ; ShowMessage(cmdpath); CreateProcessA(NULL, cmdpath.c_str(), NULL, NULL, FALSE,NULL, NULL, NULL, &sInfo, &pInfo); if(WaitForSingleObject(pInfo.hProcess,INFINITE)== WAIT_OBJECT_0) { ShowMessage("Success"); }
Use the
CopyFile
[^] Win32 API function instead.Software Zen:
delete this;
Fold With Us![^]