Board index » delphi » Help. Viewing Delphi output / The Pascal Exec command

Help. Viewing Delphi output / The Pascal Exec command

In Pascal I used to
- write my output onto a file ( Output.txt )
- use the Exec command from within pascal
- to execute a file editor ( EditorX )
- to view, print or even modify the output file.

        var
          IntX : integer;
          FloatY : real ;
          FileOut : Text;
        begin
          Assign( FileOut, 'Output.txt' );
          Rewrite( FileOut );
          Writeln(FileOut, ' Output on file output.pas ' );
          Writeln(FileOut,   IntX:5, FloatY:9:2 );
          Close(FileOut);
          Exec('c:\EditDir\EditorX',  'c:\FoutDir\Output.txt' );
        end;

*** Query 1 : Is there a Delphi version of Exec (DelphiExec) so I could
use \Windows\NotePad :-
          Writeln( FileOut, , ,  );
          Close(FileOut);
          DelphiExec( 'c:\Windows\NotePad.exe  Output.txt' );

*** Query 2 : Are there better ways to do this in Delphi.

*** Query 3 : Can the lengthy coding of Memos be reduced.
Memos seem awkward compared to the above Writeln command.

  Memo1.Lines.Add( FloatToStrF(  IntX, ffFixed, 5, 0)
                 + FloatToStrF(FloatY, ffFixed, 9, 2) );

*** Query 4 : Can a scroll bar be added to memos to allow longer output.

*** Query 5 : How can I get a clean print of the memo and an easy to look
at screen
The whole form can be printed, but appears with a lot of grey.
This can be fixed by making the memo background colour white,
but then the screen becomes glaring white and is hard to look at.

I have also tried creating an output database so I could view output -
but this is too awkward.

It is such a relief to be able to ask these questions. Thanks for your
replies in advance.

Andrew Gunner.

 

Re:Help. Viewing Delphi output / The Pascal Exec command


In article <40gvqr$...@otis.netspace.net.au>, I wrote :

Quote

>In Pascal I used to
>- write my output onto a file ( Output.txt )
>- use the Exec command from within pascal
>- to execute a file editor ( EditorX )
>- to view, print or even modify the output file.
>...

>*** Query 1 : Is there a Delphi version of Exec
> ...

I have worked out an answer to one of my own questions.

Here is code for one way of presenting program results by
- writing output to a file and then
- viewing or printing the file using NotePad.

Uses
  WinCrt ,  { for screen, keyboard input amd output ? }
  WinTypes,  { for Sw_ShowMaximised }
  WinProcs ; { winExec }

Var
  Command : string ;
  Fout : text ;

begin
  Assign( Fout, 'Output.pas');
  Rewrite(Fout);
  ...
  Writeln(Fout, 'This is the program output ');
  ...
  Close( fout );
  Command := 'c:\Windows\NotePad.exe Output.Txt' + #0 ;

  if WinExec( @command[1], Sw_ShowMaximized ) < 32
  then writeln(' WinExec failed to execute ');

end;

I found this in "Delphi for Dummies", p332.
I could not find adequate documentation for ShellExecute,
even in Delphi booksrunning to 1200 pages it was only mentionned.
I am shocked at the lack of adequate documentation,
which includes simple worked examples.  

Delphi comes on cd. Surely there is room there for an extensive
encyclopedia of Delphi and Windows and other related information.

 Andrew, Melbourne, Australia.

Other Threads