I'm trying to find a way to send the console output from an application that is run via a shellexecute api.
For example, the below lines of code will do a shell execute that produces a console window that has the time on it (this is just an example...I know how to obtain system time...again it' just an example).
I'd like to be able to send a copy of the output of the console that results from my shellexecute api to the heap.
Any ideas? Of tried a few things....having trouble. Code samples would be appreciated vice just pointing to an API. Thanks,/jbs
------code sample-------
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
int iReturn=0;
//Declare and execute the shellexecute api
HWND hwnd = NULL;
LPCTSTR lpVerb = NULL;
LPCTSTR lpFile = TEXT("cmd.exe"
LPCTSTR lpParameters = " /k time /t";
LPCTSTR lpDirectory = "c:\\windows\\system32\\";
INT nShowCmd = SW_SHOWNORMAL;
HINSTANCE hReturn;
hReturn=ShellExecute(hwnd, lpVerb, lpFile, lpParameters, lpDirectory, nShowCmd);
return (iReturn);
}
For example, the below lines of code will do a shell execute that produces a console window that has the time on it (this is just an example...I know how to obtain system time...again it' just an example).
I'd like to be able to send a copy of the output of the console that results from my shellexecute api to the heap.
Any ideas? Of tried a few things....having trouble. Code samples would be appreciated vice just pointing to an API. Thanks,/jbs
------code sample-------
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
int iReturn=0;
//Declare and execute the shellexecute api
HWND hwnd = NULL;
LPCTSTR lpVerb = NULL;
LPCTSTR lpFile = TEXT("cmd.exe"
LPCTSTR lpParameters = " /k time /t";
LPCTSTR lpDirectory = "c:\\windows\\system32\\";
INT nShowCmd = SW_SHOWNORMAL;
HINSTANCE hReturn;
hReturn=ShellExecute(hwnd, lpVerb, lpFile, lpParameters, lpDirectory, nShowCmd);
return (iReturn);
}