createprocess
-
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
-
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
-
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
You can pass NULL, 0, and/or FALSE for all the parameters except lpApplicationName, lpStartupInfo, and lpProcessInformation. That should simplify it :) Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
You might want to take a look at this: http://www.codeproject.com/threads/CreateProcessEx.asp [^]
// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
} -
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
dellthinker wrote:
I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly.
:omg: Beyond words. Why not show us what you've tried so we can see where you've gone astray?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
dellthinker wrote:
I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly.
:omg: Beyond words. Why not show us what you've tried so we can see where you've gone astray?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
Im having trouble with this.
#include #include using namespace std; int main(i) { CreateProcess(("notpad.exe"),NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL); printf("Failed because: %s", GetLastError()); return 0; }
-
Im having trouble with this.
#include #include using namespace std; int main(i) { CreateProcess(("notpad.exe"),NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL); printf("Failed because: %s", GetLastError()); return 0; }
dellthinker wrote:
int main(i)
What's this?
dellthinker wrote:
printf("Failed because: %s", GetLastError());
Should be:
printf("Failed because: %lu", GetLastError());
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
Hi all, I've been struggling with the WinAPI CreateProcess for some time now. I've googled/yahoo'ed all over to find a simple explanation on how to use it and i havnt found anything close to how to use it properly. I know it takes 10 parameters in order to use so says MSDN. But im still not finding a way to use it for something simply. Any help and or suggestions on the matter is greatly appreciated. Thanx in advance!
See the FAQ 6.4 How do I run another program from my program?[^]
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Hungarian notation FTW
-
Im having trouble with this.
#include #include using namespace std; int main(i) { CreateProcess(("notpad.exe"),NULL,NULL,NULL,FALSE,0,NULL,NULL,NULL,NULL); printf("Failed because: %s", GetLastError()); return 0; }
Is "notpad.exe" the app you want to run? Also you need to pass something to those last two parameters, especially the last one, since there's some handles returned that need to be freed.
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(STARTUPINFO));
StartupInfo.cb = sizeof(STARTUPINFO);PROCESS_INFORMATION ProcessInformation;
if (0 == ::CreateProcess(_T("C:\\Windows\\system32\\notepad.exe"), // LPCTSTR lpApplicationName,
NULL, // LPTSTR lpCommandLine,
NULL, // LPSECURITY_ATTRIBUTES lpProcessAttributes,
NULL, // LPSECURITY_ATTRIBUTES lpThreadAttributes,
FALSE, // BOOL bInheritHandles,
NORMAL_PRIORITY_CLASS, // DWORD dwCreationFlags,
NULL, // LPVOID lpEnvironment,
NULL, // LPCTSTR lpCurrentDirectory,
&StartupInfo, &n