Gallery
Software
Music
Programming
Archive
Friday, Jul 19 Week 29

Execute a program or web-URL

Run a program or web-link using ShellExecute api command.

Test

uses
shellApi;

function launch(pFileName:pAnsiChar;pParams:pAnsiChar=nil):boolean;
const sz=sizeOf(TShellExecuteInfoA);
var si:TShellExecuteInfoA;
begin
pFill(@si,sz);
si.cbSize := sz;
si.fMask := SEE_MASK_NOCLOSEPROCESS;
si.wnd := windows.getDesktopWindow;
si.lpFile := pFileName;
si.lpParameters := pParams;
si.lpDirectory := nil;
si.nShow := SW_SHOWNORMAL;
result:=ShellExecuteExA(@si);
end;

//example:
//launch('http://www.mortenbs.com/');

Related pages of Execute a program or web-URL

Delphi examples
Use TLabel as a web link
Delphi programming
Programming