Board index » delphi » ExecProgram didn't work for launching an external executable within a Delphi unit

ExecProgram didn't work for launching an external executable within a Delphi unit

I like to launch some external executables within a Delphi unit. Therefore
I used the following syntax within the FormActivate method:

procedure TForm1.FormActivate(Sender: TObject);
begin
  ExecProgram('C:\ONLINEPP\OPSECR.EXE', 0);
end;

This didn't work.  It results in an error 'undeclared identifier'.

Maybe the cause is that  I didn't put the right reference in my using
clause.
Or maybe I will need the win32 sdk to use the previous mentioned command..

Can somebody help me.

 

Re:ExecProgram didn't work for launching an external executable within a Delphi unit


Quote
Frans Verhoeven wrote:

  I like to launch some external executables within a Delphi unit.
  Therefore
  I used the following syntax within the FormActivate method:

  procedure TForm1.FormActivate(Sender: TObject);
  begin
    ExecProgram('C:\ONLINEPP\OPSECR.EXE', 0);
  end;

  This didn't work.  It results in an error 'undeclared identifier'.

  Maybe the cause is that  I didn't put the right reference in my
  using
  clause.
  Or maybe I will need the win32 sdk to use the previous mentioned
  command..

  Can somebody help me.

for 16 bit
 try Winexec('c:\ONLINEPP\OPSECR.EXE', SW_SHOWNORMAL);
for 32 bit
try ShellExecute(0, 'c:\ONLINEPP\OPSECR.EXE', nil, nil, nil, SW_Normal);

//check the win32 api for all options

Paul

Re:ExecProgram didn't work for launching an external executable within a Delphi unit


Quote
Frans Verhoeven wrote:

> I like to launch some external executables within a Delphi unit.
> Therefore I used the following syntax within the FormActivate method:

> procedure TForm1.FormActivate(Sender: TObject);
> begin
>   ExecProgram('C:\ONLINEPP\OPSECR.EXE', 0);
> end;

> This didn't work.  It results in an error 'undeclared identifier'.

  In Delphi 1, try WinExec and in Delphi 2, use CreateProcess.

--
Jason
Dark...@SLSoftware.reno.nv.us

Other Threads