Board index » delphi » How to execute dos pgm in delphi pgm...

How to execute dos pgm in delphi pgm...

I have a barcode printer...
I have to execute dos pgm, barprt.exe for printing
I know WinExec().. But WinExec() don't execute dos pgm which has
arguments..

help me .... Thanks in advance..

 

Re:How to execute dos pgm in delphi pgm...


Hi,

Make first a PIF-file from your DOS-BarPrt.exe

var SI: TStartupInfo; PI:TProgressInformation;
begin
   FillChar(PI,SizeOf(PI),#0);
   FillChar(SI,SizeOf(SI),#0);
   with SI do begin
       cb         := SizeOf(SI);
       dwFlags    := STARTF_USESHOWWINDOW;
       wShowWindow:= SW_SHOW; //or SW_SHOWMINIZED,...
   end;
   if not CreateProcess(
         'C:\.....\BarPrt.pif',
         'BarPrt.exe /options',
          nil, nil, false,
          NORMAL_PRIORITY_CLASS,
          nil, nil, SI, PI) then
      raise
      Exception.Create('Error CreateProcess');
      WaitForSingleObject(PI.dwProcessID, INFINITE);
end;

Rudy
===================================================

Quote
park,leejung wrote:

> I have a barcode printer...
> I have to execute dos pgm, barprt.exe for printing
> I know WinExec().. But WinExec() don't execute dos pgm which has
> arguments..

> help me .... Thanks in advance..

Other Threads