well this is guna sound so noobish

but how do i open a program.
like if i am running one program how do i make that program open and run a different one.
ie. notepad opens and runs the calculator
something like that (not using those programs of course)

Posted on 2003-09-08 13:46:25 by njkt809
CreateProcess does that,
Posted on 2003-09-08 13:48:26 by donkey
ok thanks.
Posted on 2003-09-08 13:50:43 by njkt809
ok another question,
how do i set up

those two im unsure about, any help would be cool,

Posted on 2003-09-08 14:54:16 by njkt809
Hi, njkt809.
Take a good look at the API's description. You will se that you only need to set up one of this two structures (processinfo if I recall correctly), the other structure will be filled on fuction's return.
The one you have to fill is the longest one :P but it's fairly straight forward, since you are not going to use most of that stuff unless you want to try something more complicated (like piping the program's output, and stuff like that). Zeroing everything but the structure's size should work fine, unless I'm missing something.
Posted on 2003-09-08 15:09:53 by QvasiModo
ok so then the creat process would go like this

invoke CreateProcess,addr test1,0,0,0,FALSE,0,0,0,0,_PROCESSINFO
Posted on 2003-09-08 15:28:23 by njkt809
StartupInfo STARTUPINFO <>

invoke CreateProcessA,0,offset Target2,0,0,0,CREATE_SUSPENDED,\
0,0,offset StartupInfo,offset ProcessInfo

invoke ResumeThread,ProcessInfo.hThread
invoke CloseHandle,ProcessInfo.hThread
invoke CloseHandle,ProcessInfo.hProcess
invoke ExitProcess,0

for what im using thing for i have to suspended the process one i create it if you dont then you can just remove it
Posted on 2003-09-08 15:33:16 by devilsclaw
WOOO, that was exactly wat i was looking for, ok i get everything now haha sorry it took so long.

Posted on 2003-09-08 15:36:18 by njkt809
Mh, sorry, I actually meant to zero all members of the structures. But you have to provide the pointers to the structures to CreateProcess or it will fail.
BTW, it was STARTUPINFO that had to be filled :o
So it would be

local sinfo:STARTUPINFO

invoke RtlZeroMemory,addr sinfo,sizeof sinfo
invoke RtlZeroMemory,addr pinfo,sizeof pinfo
mov sinfo.cb,sizeof STARTPINFO
invoke CreateProcess,0,addr test1,0,0,0,0,0,0,addr sinfo,addr pinfo

EDIT: I see I posted too late :grin:
Posted on 2003-09-08 15:37:52 by QvasiModo
I see I posted too late, too :grin:

But what about
The ShellExecute function opens or prints a specified file. The file can be an executable file or a document file. See ShellExecuteEx also.

HINSTANCE ShellExecute(

HWND hwnd, // handle to parent window
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename or folder name string
LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened

usually I need just lpFile to be defined
Posted on 2003-09-08 22:30:35 by S.T.A.S.