Programming => Packages and Libraries => Ported from Delphi/Kylix => Topic started by: ac on December 01, 2006, 10:02:23 am

Title: pShellExecuteInfo ?
Post by: ac 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);
         Info: TShellExecuteInfo;
         pInfo: pShellExecuteInfo;
         exitCode: DWord;
         pInfo := @Info;
         if (debug<>'false') then
         with Info do
            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;
            exitCode := WaitForSingleObject(Info.hProcess, 500);
            until (exitCode <> WAIT_TIMEOUT);

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
Title: RE: pShellExecuteInfo ?
Post by: Legolas 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]
  PShellExecuteInfo = ^TShellExecuteInfo;