ShellExecute (
  hWnd: HWND;         {Specify parent window handle}
  Operation: PChar;   {specified action, for example: open, print}
  FileName: PChar;    {Specify a file or program to open}
  Parameters: PChar; {Specify parameters for the program to be opened; if the file is opened, it should be nil}
  Directory: PChar;   {default directory}
  ShowCmd: Integer    {Open option}
): HINST;             {Successful execution will return the application handle; if this value is <= 32, it means an execution error}

// The possible errors of the return value are:
                       = 0   {Not enough storage}
ERROR_FILE_NOT_FOUND = 2;   {File name error}
ERROR_PATH_NOT_FOUND = 3;   {Path name error}
ERROR_BAD_FORMAT = 11; {EXE file is invalid}
SE_ERR_SHARE = 26; {Share error occurred}
SE_ERR_ASSOCINCOMPLETE = 27; {File name is incomplete or invalid}
SE_ERR_DDETIMEOUT = 28; {Timeout}
SE_ERR_DDEFAIL = 29; {DDE transaction failed}
SE_ERR_DDEBUSY = 30; {Processing other DDE transaction cannot complete the DDE transaction}
SE_ERR_NOASSOC = 31; {No associated applications}

// ShowCmd parameter optional values:
SW_HIDE = 0;   {Hide}
SW_SHOWNORMAL = 1;   {Display with recent size and position, activate}
SW_NORMAL = 1;   {Same as SW_SHOWNORMAL}
SW_SHOWMINIMIZED = 2;   {Minimize, Activate}
SW_SHOWMAXIMIZED = 3;   {Maximize, activate}
SW_MAXIMIZE = 3;   {Same as SW_SHOWMAXIMIZED}
SW_SHOWNOACTIVATE = 4;   {Display with recent size and position, inactive}
SW_SHOW = 5;   {Same as SW_SHOWNORMAL}
SW_MINIMIZE = 6;   {Minimize, Inactive}
SW_SHOWMINNOACTIVE = 7;   {Same as SW_MINIMIZE}
SW_SHOWNA = 8;   {Same as SW_SHOWNOACTIVATE}
SW_RESTORE = 9;   {Same as SW_SHOWNORMAL}
SW_SHOWDEFAULT = 10; {Same as SW_SHOWNORMAL}
SW_MAX = 10; {Same as SW_SHOWNORMAL}


// Illustrate more questions (don't forget to use ShellAPI;):

{Eg open a file with notepad}
begin 
  ShellExecute (Handle,'open', 'notepad.exe', 'C: \ WINDOWS \ SchedLgU.Txt', nil , SW_SHOWNORMAL);
end ;


{The first parameter is used as the parent window of the error prompt window, not nil, but can be 0 (that is, the desktop window)}
begin 
  ShellExecute (0, 'open', 'notepad.exe', 'C: \ WINDOWS \ SchedLgU.Txt', nil , SW_SHOWNORMAL);
end ;


{If the second parameter is nil, it will also be open by default}
begin 
  ShellExecute (0, nil ,'notepad.exe', 'C: \ WINDOWS \ SchedLgU.Txt', nil , SW_SHOWNORMAL);
end ;


{File path can be placed in parameter five}
begin 
  ShellExecute (0, nil ,'notepad.exe', 'SchedLgU.Txt', 'C: \ WINDOWS', SW_SHOWNORMAL);
end ;


{Specify parameter three directly as the file to be opened, and the file will be opened with the corresponding default program; the number of times parameter four should be nil}
begin 
  ShellExecute (0, nil ,'SchedLgU.Txt', nil ,'C: \ WINDOWS', SW_SHOWNORMAL);
end ;


{If the file is in: program directory / current directory / System32 / Windows / PATH environment variable, parameter five can also be nil}
begin 
  ShellExecute (0, nil ,'SchedLgU.Txt', nil ,nil , SW_SHOWNORMAL);
end ;


{If parameter three is a file, you can print it with parameter two command}
begin 
  ShellExecute (0, 'print', 'SchedLgU.Txt', nil ,nil ,1);
end ;


{Open webpage with IE}
begin 
  ShellExecute (Handle,'open', 'IExplore.EXE', 'about: blank', nil , SW_SHOWNORMAL);
end ;


{Open web page with Firefox}
begin 
  ShellExecute (Handle,'open', 'firefox.exe', 'about: blank', nil , SW_SHOWNORMAL); 
end ;


{Open webpage with default browser}
begin 
  ShellExecute (Handle,'open', 'Explorer.exe', 'about: blank', nil , SW_SHOWNORMAL);
end ;


{Still open webpage with default browser}
begin 
  ShellExecute (0, nil ,'http://www.google.com', nil ,nil ,1);
end ;