uses Mapi;
...
procedure TfrmMain.btnOpenAddressBookClick(Sender: TObject);
var
lhSession, rc: Cardinal;
lpnNewRecips: PULONG;
lppNewRecips: PMapiRecipDesc;
lpRecips: MapiRecipDesc;
begin
lpnNewRecips := nil;
rc := MAPILogon(0, 'Севостьянов Игорь', '', MAPI_LOGON_UI, 0, @lhSession);
if (rc < > SUCCESS_SUCCESS) then
SysErrorMessage(rc);
rc := MAPIAddress(lhSession, 0, 'Адресная книга', 0, '', 0, lpRecips, 0, 0,
lpnNewRecips, lppNewRecips);
if (rc < > SUCCESS_SUCCESS) then
SysErrorMessage(rc)
else
rc := MAPIFreeBuffer(lppNewRecips); // free the memory used by MAPIAddress
if (rc < > SUCCESS_SUCCESS) then
SysErrorMessage(rc);
rc := MAPILogoff(lhSession, 0, 0, 0);
if (rc < > SUCCESS_SUCCESS) then
SysErrorMessage(rc);
end;
|