1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| var
AccountManager : IOlkAccountManager;
AccountHelper : IOlkAccountHelper;
AccountEnum : IOlkEnum;
PAE : IUnknown;
Result : HRESULT;
compte : Cardinal;
LPUK : LPUNKNOWN;
begin
Result := ActiveX.CoInitialize(nil);
if Result <> S_OK then
begin
showmessage('Echec ActiveX.CoInitialize :'+IntToHex(Result, 8)); Application.Terminate;
end;
Result := ActiveX.CoCreateInstance(CLSID_OlkAccountManager,
nil, CLSCTX_INPROC_SERVER, IID_IOlkAccountManager,
AccountManager);
if Result <> S_OK then
showmessage('Echec de la création de l''instance :'+IntToHex(Result, 8));
Result := AccountManager.Init(AccountHelper, OLK_ACCOUNT_NO_FLAGS);
if Result <> S_OK then
showmessage('Echec de l''initialisation de AccountManager :'+IntToHex(Result, 8));
if AccountEnum <> nil then
showmessage('ok');
Result := AccountManager.EnumerateAccounts(@CLSID_OlkMail, @CLSID_OlkPOP3Account, OLK_ACCOUNT_NO_FLAGS, AccountEnum);
if Result <> S_OK then
showmessage('echec du listing des comptes :'+IntToHex(Result, 8));
if AccountEnum <> nil then
showmessage('ok2');
Result := AccountEnum.Reset;
if Result <> S_OK then
showmessage('erreur AccountEnum.reset :' + IntToHex(Result, 8));
Result := AccountEnum.GetNext(LPUK);
if Result <> S_OK then
showmessage('erreur AccountEnum.GetNext :'+IntToHex(Result, 8));
compte := 1;
Result := AccountEnum.GetCount(@compte);
if Result <> S_OK then
showmessage('erreur AccountEnum.GetCount :'+IntToHex(Result, 8));
showmessage(inttostr(compte));
AccountEnum := nil;
AccountHelper := nil;
AccountManager := nil;
ActiveX.CoUninitialize; |
Partager