Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Oct : Launching an application from a service

www.cryer.info
Managed Newsgroup Archive

Launching an application from a service

Subject:Launching an application from a service
Posted by:"Mike_" (_@_._)
Date:Wed, 12 Oct 2005 17:18:21

Hi,
I've managed to write a service application.
From within this thread I have to launch an application.
I need to unzip an archive. Unfortunately, using the "classic" scheme of
launching across "ShellExecuteEx" (see code below) the neither SMC nor the
application that is "launched" returns any error or does the job.
So, what can I do?

Any idea is welcomed.

Code:
  FillChar(ExecInfo, SizeOf(ExecInfo), 0);
  with ExecInfo do begin
    cbSize := SizeOf(ExecInfo);
    fMask := SEE_MASK_NOCLOSEPROCESS;
    Wnd := 0;
    lpFile := PChar(lExec);
    lpParameters := PChar(lParam);
    nShow := SW_HIDE;
  end;
  ShellExecuteEx(@ExecInfo);
  RaiseLastOSError;
  try
   WaitForSingleObject(ExecInfo.hProcess, INFINITE);
  finally
   CloseHandle(ExecInfo.hProcess);
  end;
Where:
  lExec = 'Winzip32.exe'
  lParam = ' -min -e -o archive.zip'

Thanks,
Mike_

Replies:

www.cryer.info
Managed Newsgroup Archive