Questions tagged [createprocess]

Refers to programmatically running an application from another.

In the Windows API the function CreateProcess is used to create a new process.

See for similar functionality on UNIX/POSIX systems.

609 questions
12
votes
0 answers

What happens when I double click an executable, technically

tl;dr I'm trying to understand the difference of running a program directly via double clicking the executable vs running it through a terminal or programatically via CreateProcess in windows 10. long version Because this is my problem, executing…
majidarif
  • 18,694
  • 16
  • 88
  • 133
12
votes
1 answer

Use CreateProcess to Run a Batch File

I am trying to use CreateProcess to start a new environment block and run a batch file in the new environment block. I've read through the msdn example for CreateProcess, and came up with the code shown below. What is happening, it will open the new…
user2970916
  • 1,146
  • 3
  • 15
  • 37
12
votes
3 answers

CreateProcess and ShellExecute differences

What are the main differences between the two? I'm willing to run only another EXE from my (C++) application. Are there any differences when inheriting environments, security features etc?
Samuel
  • 2,430
  • 5
  • 31
  • 41
11
votes
1 answer

Using a handle to collect output from CreateProcess()

I am using CreateProcess() to run an external console application in Windows from my GUI application. I would like to somehow gather the output to know whether there were errors. Now I know I have to do something with hStdOutput, but I fail to…
Stef
  • 446
  • 1
  • 4
  • 19
10
votes
3 answers

CreateProcess with new console window, but override some std i/o handles

If you use CreateProcess with the flag CREATE_NEW_CONSOLE, the new process has its standard input, output, and error handles directed to the new console window. If you want to override the I/O streams, you can do so by setting the handles in…
Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
9
votes
2 answers

What is the difference between NtCreateProcess and ZwCreateProcess?

What is the difference between NtCreateProcess and ZwCreateProcess? In ntdll.dll, both NtCreateProcess and ZwCreateProcess point to exactly the same address
小太郎
  • 5,510
  • 6
  • 37
  • 48
9
votes
4 answers

How to determine when spawned process is ready? (Using CreateProcess() and FindWindow())

This should be an easy one: I am creating a program that spawns a process using the win32 CreateProcess() function. Once this process is loaded, I find its window using FindWindow and send it messages using SendMessage(). The question is, how do I…
Courtney Christensen
  • 9,165
  • 5
  • 47
  • 56
9
votes
5 answers

Way to pass argv[] to CreateProcess()

My C Win32 application should allow passing a full command line for another program to start, e.g. myapp.exe /foo /bar "C:\Program Files\Some\App.exe" arg1 "arg 2" myapp.exe may look something like int main(int argc, char**argv) { int i; for…
Ilia K.
  • 4,822
  • 2
  • 22
  • 19
9
votes
3 answers

unelevated program starts an elevated updater, updater should wait for finishing of program

I have 2 apps, program.exe and updater.exe, both written in Delphi5. Program runs without admin-rights (and without manifest), updater has a manifest with "requireAdministrator" because he must be able to write at Program-Folder to update…
8
votes
4 answers

How to launch a GUI program in a Windows service?

When I run a service as LocalSystem account, I can use following codes to launch a GUI program under current login account: WTSGetActiveConsoleSessionId->WTSQueryUserToken->CreateProcessAsUser However, when I run the service as my personal account,…
trudger
  • 917
  • 2
  • 12
  • 20
8
votes
2 answers

How to bring window on top of the process created through CreateProcess

I am launching a process from my application using CreateProcess API and I want to bring the window of the new process to top. Is there a way to do it? Do we have any flag or something like that with CreateProcess?
Rahul
  • 1,401
  • 4
  • 17
  • 33
8
votes
0 answers

Windows - CreateProcess detach child

I want to create a child process that is detached from the parent, so that if the parent exits, the child process will continue. I'm working on Windows and did this: if(CreateProcess(program, arguments, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE |…
goocreations
  • 2,938
  • 8
  • 37
  • 59
8
votes
2 answers

error C3861: '_tcsdup': identifier not found

This is my first time and I'd like to make a parallel process using the windows CreateProcess function. Based on the example at MSDN I created a LPTSTR "(non-const) TCHAR string" command line argument like this LPTSTR szCmdline[] =…
forest.peterson
  • 755
  • 2
  • 13
  • 30
8
votes
3 answers

forking() and CreateProcess()

Are forking() and CreateProcess(with all required arguments), the same thing for Linux and WinXP, respectively? If they are different, then could someone explain the difference in terms of what happens in each of the two cases? Thanks
Sunny
  • 7,444
  • 22
  • 63
  • 104
7
votes
1 answer

CreateProcess fails under windows 7

I'm trying to compile legacy code from Windows XP under a new environment in Windows 7. It compiles but fails at runtime. CreateProcess() returns 0 and GetLastError() returns 2, which stands for ERROR_FILE_NOT_FOUND Here is my call to…
Eric
  • 19,525
  • 19
  • 84
  • 147
1
2
3
40 41