Jump to content

open program and send value

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
q19

q19

    Newbie

  • Members
  • Pip
  • 1 posts
hi,

i thought this might be a easy task but i am not able to manage it.

task:
- read an integer value from edit1.text
- start a program.exe (via cmd)
- add +5 to the integer value and send this value to the opened program

what would be the easiest way to do this??

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The easiest would be to pass the value as a command line parameter. If you need to communicate with the program, you need to know what messaging systems it supports (if it isn't yours) or that you want to implement (if it is).
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
krwq

krwq

    Newbie

  • Members
  • PipPip
  • 28 posts
It's not so easy. In Delphi you can use:
MaxX's delphi site - TDosCommand
to execute some command
DosCommand1.CommandLine:='ping google.coml';

DosCommand1.Execute;
to receive you must assign and action to event onNewline. For example:
procedure TForm1.DosCommand1cNewLine(Sender: TObject; NewLine: String;

  OutputType: TOutputType);

var

  num,newnum: Integer;

begin

  num:=StrToInt(NewLine);

  // process somehow this variable

  newnum:=num+5;

  dosc.SendLine(IntToStr(newnum),true);

end;

not compiled but should work ok