Hi
I have to excecute a exe which is available in some drive how can i do this using c++??
I am doing like this
#include <stdio.h>
#include <conio.h>
#include <windows.h>
void main()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if(!CreateProcess(L"c:\\DOTNET.exe",NULL,NULL, NULL,FALSE, 0,NULL,NULL,&si,&pi ) )
{
printf( "CreateProcess failed (%d).\n", GetLastError() );
}
else
{
printf("Prcess Creation Success");
}
WaitForSingleObject( pi.hProcess, INFINITE );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
getch();
}
But every time it is showing process creation failed with error code 2(i.e can not find the path specified) but i place the DOTNET.exe at c:\DOTNET.exe only.
what is wrong in the above code.can any one suggest me...
Any help is greately appreciated..
Thabks in advance.