Recent

Author Topic: pShellExecuteInfo ?  (Read 7268 times)

ac

  • New Member
  • *
  • Posts: 14
pShellExecuteInfo ?
« on: December 01, 2006, 10:02:23 am »
Hi Guys,

I'm porting a project from Delphi to Lazarus and there are some problems with shell execution.

the code:
Code: [Select]

procedure RunAndWaitShell(Executable, Parameter: STRING; ShowParameter: INTEGER);
      var
         Info: TShellExecuteInfo;
         pInfo: pShellExecuteInfo;
         exitCode: DWord;
      begin
         pInfo := @Info;
         if (debug<>'false') then
         begin
            ShowParameter:=0;
         end;
         with Info do
         begin
            cbSize := SizeOf(Info);
            fMask  := SEE_MASK_NOCLOSEPROCESS;
            wnd    := application.Handle;
            lpVerb := NIL;
            lpFile := PChar(Executable);
            lpParameters := PChar(Parameter + #0);
            lpDirectory  := NIL;
            nShow        := ShowParameter;
            hInstApp     := 0;
         end;
         ShellExecuteEx(pInfo);
         repeat
            exitCode := WaitForSingleObject(Info.hProcess, 500);
            Application.ProcessMessages;
            until (exitCode <> WAIT_TIMEOUT);
      end;    


the error:
Code: [Select]

Error: Identifier not found "pShellExecuteInfo"


Maybe pShellExecuteInfo is only supported for Delphi or something like that. Is there anything to handle this in lazarus?

Regards, ac

Legolas

  • Full Member
  • ***
  • Posts: 117
    • http://itaprogaming.free.fr
RE: pShellExecuteInfo ?
« Reply #1 on: December 01, 2006, 02:04:51 pm »
PShellExecuteInfo should be a pointer to TShellExecuteInfo, so simply try to declare a new type:

Code: [Select]
type
  PShellExecuteInfo = ^TShellExecuteInfo;

 

TinyPortal © 2005-2018