获取电子邮件地址(WAP)
procedure GetMailAddress(Wab: TStrings);
var
lpRecip: TMapiRecipDesc;
intRecips: ULONG;
lpRecips: PMapiRecipDesc;
i: Integer;
hMapi: PLHANDLE;
begin
if (MapiLogOn(0, nil, nil, MAPI_LOGON_UI, 0, @hMapi) = SUCCESS_SUCCESS) then
begin
if (MAPIAddress(0, GetActiveWindow, '', 1, '', 0, lpRecip, 0, 0, @intRecips,
lpRecips) = SUCCESS_SUCCESS) then
begin
for i := 0 to intRecips - 1 do
Wab.Add(PMapiRecipDesc(PChar(lpRecips) +
i * SizeOf(TMapiRecipDesc))^.lpszAddress + ',' + PMapiRecipDesc(PChar(lpRecips) +
i * SizeOf(TMapiRecipDesc))^.lpszName);
MAPIFreeBuffer(lpRecips)
end;
Wab.Text :=StringReplace(Wab.Text, 'SMTP:', '', [Rfreplaceall, rfignorecase]);
end;
end;