Hello all
I am attempting to make quiet system calls from C++ in order to run a batch file without the user knowing. I am going to eventually make this cross platform (windows and linux) although for now i am currently looking for a windows solution.
So I guess i'm looking for two things...
1. To call a program from windows without the user knowing
2. C++ program to pause until the system call has completed
Ideas?
|
Team Leader
|
![]() |
| 18May2007,03:01 | #2 |
|
See the "system" keyword, and output redirection.
|
|
Go4Expert Member
|
|
| 18May2007,03:53 | #3 |
|
the system keyword makes the command prompt box appear, this is what i am trying to avoid. I am trying shellExecute() with the hide flag, but the c++ app seems to not wait for the command to quit before continuing on, if this was fixed, i would be golden.
|
|
Go4Expert Member
|
|
| 18May2007,05:40 | #4 |
|
Code:
string cmdline = "pscp.exe -r -batch -scp -pw \""+m_password+"\" \""+m_file+"\" \""+m_username+"\"@\""+m_host+"\":\""+m_remotedir+"\"";
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
char *szExe = (char *)cmdline.c_str();
if(CreateProcess(0, (LPSTR)szExe, 0, 0, FALSE, 0, 0, 0, &si, &pi))
{
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
|

