Recent

Author Topic: Questions about input and output pipe in Lazarus TProcess  (Read 253 times)

iruanpan

  • Newbie
  • Posts: 1
Questions about input and output pipe in Lazarus TProcess
« on: May 24, 2022, 02:20:06 am »
I would like to make a terminal with a Lazarus GUI application. But I'm in trouble. And I hope someone can help me, please.


Question1 was solved with encoding.
Question1: The Chinese and other special chars cannot display normally, I would like to know how to fix this problem.

(code)Class of the thread and "run" button on click event: https://i.stack.imgur.com/ZObEW.png

screenshot: https://i.stack.imgur.com/pymqT.png


Question2: I want to know how to input some command into the console. For example, I would like to start a Minecraft server, and execute a command in the console with TProcess. I tried to start a Windows cmd, and use "ver" command. But when I click the button, nothing happened.

The send command button: https://i.stack.imgur.com/ZfZfC.png

The write function returns 0.
« Last Edit: May 24, 2022, 09:27:49 am by iruanpan »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10070
  • FPC developer.
Re: Questions about input and output pipe in Lazarus TProcess
« Reply #1 on: May 26, 2022, 08:49:18 pm »
I have this project as an interactive test of tprocess:

http://www.stack.nl/~marcov/files/processmemodemo.zip

instructions: 
  • compile testit.lpr   (on cmdline or as "simple program")
  • compile the main processtomemo lazaursproject
  • Run processtomemo and press the lower button

I hope it helps you in your direction.

 

TinyPortal © 2005-2018