Igor Delovski Board Forum Index Igor Delovski Board
My Own Personal Slashdot!
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Processes

 
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32
Win32  
Author Message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Sun Apr 10, 2022 10:54 am    Post subject: Processes Reply with quote

msft - Creating a Child Process with Redirected Input and Output

"The example in this topic demonstrates how to create a child process using
the CreateProcess function from a console process. It also demonstrates a
technique for using anonymous pipes to redirect the child process's standard
input and output handles. Note that named pipes can also be used to redirect
process I/O."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Mar 20, 2023 8:32 pm    Post subject: Reply with quote

so - Execute command using Win32

Having standard input:
Code:
STARTUPINFO si = {0};
si.cbSize = sizeof(si);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
si.hStdOutput = hStdOutWr;
si.hStdError = hStdErrWr;
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Mar 20, 2023 8:48 pm    Post subject: Reply with quote

so - Using ShellExecuteEx and capturing standard in/out/err

Use text editor and type dir > out.txt and save it with mybat.bat (*.bat, don't *.txt)
In your c/c++ program, type WinExec("mybat.bat", SW_HIDE); and run your application.
Open the out.txt you will see the name of folders and files in current directory.
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Wed Mar 29, 2023 4:57 pm    Post subject: Reply with quote

so - winapi: CreateProcess but hide the process' window?

"If its just a console app you can also use the CREATE_NO_WINDOW flag as
part of the CreateProcess call itself."
Back to top
View user's profile Send private message
Ike
Kapetan


Joined: 17 Jun 2006
Posts: 3026
Location: Europe

PostPosted: Mon Apr 03, 2023 9:04 am    Post subject: Reply with quote

betaarchive.com - HOWTO: Spawn Console Processes with Redirected Standard Handles

"This article describes how to redirect the input and output of a child process
that receives input from the standard input handle or sends output to the
standard output handle. The Win32 API enables applications to spawn a child
console process with redirected standard handles. This feature allows a parent
process to send and receive the input and output of the child process."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Igor Delovski Board Forum Index -> Win32 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Delovski.hr
Powered by php-B.B. © 2001, 2005 php-B.B. Group