Using the following code, it works fine on development system but on the system it is installed on, 'Access denied' is returned.
 
They can click in a hyperlink in a web browser and it works file, however any type of URL passed in the function shown produces the error message.
 
procedure TMainForm.ExecURL(URL : string); //[2.4]
var ExecError : integer;
    ExecErrorMessage : string;
begin
   ExecError := ShellExecute(Mainform.Handle,PChar(''),PChar(URL),
   PChar(''),PChar(''),SW_SHOWNORMAL);
   if (ExecError <= 32) then begin
      ExecErrorMessage := ShellExErrorToString(ExecError);
      MessageBeep(mb_ICONWARNING);
      MessageDlg(ExecErrorMessage,mtWarning,[mbOK],0);
   end;
end;
 
function ShellExErrorToString(ShellExError:Integer):string;
begin
     case ShellExError of
      ERROR_FILE_NOT_FOUND:Result:='File not found';
      ERROR_PATH_NOT_FOUND:Result:='Path not found';
      ERROR_BAD_FORMAT:Result:='Bad format';
      SE_ERR_ACCESSDENIED:Result:='Access denied';
      SE_ERR_ASSOCINCOMPLETE,
      SE_ERR_NOASSOC:Result:='File association missing or incomplete';
      SE_ERR_DDEBUSY,
      SE_ERR_DDEFAIL,
      SE_ERR_DDETIMEOUT:Result:='DDE error';
      SE_ERR_DLLNOTFOUND:Result:='DLL not found';
      SE_ERR_OOM,0:Result:='Out of resources or memory';
      SE_ERR_SHARE:Result:='Sharing violation';
     else Result:='Unknown error';
     end;
end;

 
====================================
Patrick Dunford, Christchurch, New Zealand
 
 

Reply via email to