Why does the code below give me
'The user canceled one of the dialog boxes....' ?

{**********************************************************************}
procedure TfmMailForm.Button1Click(Sender: TObject);
var
  MR:integer;
  dlgCaption:string;
  EditFieldCount:integer;
  lpRecip:TMapiRecipDesc;
  intRecips:Cardinal;
  lpRecips:PMapiRecipDesc;
  strT:string;
begin
  dlgCaption:='';
  EditFieldCount:=4;
  MR:=MAPIAddress(0,Application.Handle,pChar(dlgCaption),
        EditFieldCount,'',0,lpRecip,0,0,@intRecips,lpRecips);
  if MR=SUCCESS_SUCCESS then
    begin
      ShowMessage('Success');
      {Other code removed.}
    end
  else
    begin
      case MR of
        MAPI_E_FAILURE:strT:='One or more unspecified errors occurred while
building recipient lists or browsing the address book. No list of recipients
was returned.';
        MAPI_E_INSUFFICIENT_MEMORY:strT:='There was insufficient memory to
proceed. No list of recipients was returned.';
        MAPI_E_INVALID_EDITFIELDS:strT:='The value of the nEditFields
parameterwas outside the range of 0 through 4. No list of recipients was
returned.';
        MAPI_E_INVALID_RECIPS:strT:='One or more of the recipients in the
address list was not valid or the Recipients parameter was not a valid
array. No list of recipients was returned.';
        MAPI_E_INVALID_SESSION:strT:='An invalid session handle was used for
the lhSession parameter. No list of recipients was returned.';
        MAPI_E_LOGIN_FAILURE:strT:='There was no default logon, and the user
failed to log on successfully when the logon dialog box was displayed. No
list of recipients was returned.';
        MAPI_E_NOT_SUPPORTED:strT:='The operation was not supported by the
underlying messaging system. A list of recipients may have been returned.';
        MAPI_E_USER_ABORT:strT:='The user canceled one of the dialog boxes.
No list of recipients was returned.';
      else strT:='Unknown error.';
      end;
      ShowMessage(strT);
    end;
  MAPIFreeBuffer(lpRecips);
end;

{**********************************************************************}

__________________________________________________
Delphi-Talk mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi-talk

Reply via email to