T
T
thinkkaka2020-11-26 04:19:40
cmd/bat
thinkkaka, 2020-11-26 04:19:40

How to send Ctrl+C to a specific process in VB.net?

I wrote a GUI where I set the settings, I launch a console program with these settings via CMD.
The problem is that I want to stop the console program by pressing a button in the GUI, this is usually done through "Ctrl + C".

- I tried to just kill the process, but then the file with which the program worked was damaged.
- I thought to find the CMD in which I launched the program in the processes and stop there, however, all CMD windows in the processes are called the same.

Do you have any ideas how to send Ctrl+C directly to a console program?
(if possible, write immediately with the code, I'm new at this and I may not understand in words :) )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BasiC2k, 2020-11-26
@BasiC2k

Since the console program is written by you, the solution may be simpler. Programs can communicate with each other via a pipe. Those. you can implement this and the GUI will just send a command to the console and it will close properly.
As noted above, it is better not to use keyboard emulation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question