Einzelnen Beitrag anzeigen

waldforest

Registriert seit: 8. Mai 2005
366 Beiträge
 
Delphi XE3 Enterprise
 
#3

Re: Eingerichtete Mailaccounts auflisten

  Alt 5. Mai 2008, 08:19
Danke,
habe schon mal weiter gesucht und bin auch bedingt fündig geworden.

Für Outlook z.B. in folgendem Registry Schlüssel

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\Outlook\9375CFF0413111d3B88A001 04B2A6676

sowie in folgendem Thread
http://www.delphipraxis.net/internal...t=email+konten
welches aber leider so wegen falscher Registryschlüssel "noch" nicht funktioniert.


Hier meine Lösung. Das Einzige was ich nun noch suche ist die indentifikation des Standartkontos. Vielleicht hat da jemand noch einen Tipp.

Delphi-Quellcode:
Procedure GetOEMail();
  var
    RDI: TRegistry;
    Profiles, SubKonten: TStringList;
    EmailStr, NameStr:string;
    n,p,q: integer;
  begin
    RDI := TRegistry.Create;
    tempstr :='';
    Profiles := TStringList.Create;
    SubKonten :=TStringList.Create;
    try

      RDI.RootKey := HKEY_CURRENT_USER;
      RDI.OpenKey('Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles',
        False);
      RDI.GetKeyNames(Profiles);
      for n := 0 to Profiles.Count - 1 do
      begin
        RDI.CloseKey;
        RDI.OpenKey('Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\'+
        Profiles[n]+'\9375CFF0413111d3B88A00104B2A6676', False);

        RDI.GetKeyNames(SubKonten);
        for p := 0 to SubKonten.Count - 1 do
        begin
          RDI.CloseKey;
          RDI.OpenKey('Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\'+
          Profiles[n]+'\9375CFF0413111d3B88A00104B2A6676\'+SubKonten[p], False);

          if RDI.ValueExists('Email') = True then
          begin
            SetLength(EmailStr, RDI.GetDataSize('Email'));
            RDI.ReadBinaryData('Email', EmailStr[1], Length(EmailStr));
            if EmailStr <> 'then
            begin
                repeat
                  q := Pos(#0, EmailStr);
                  if q <> 0 then
                   Delete(EmailStr, q, 1);
                until q = 0;
                if(RDI.ValueExists('Display Name') = True) then
                begin
                 SetLength(NameStr, RDI.GetDataSize('Display Name'));
                 RDI.ReadBinaryData('Display Name', NameStr[1], Length(NameStr));
                 if NameStr <> 'then
                 begin
                  repeat
                    q := Pos(#0, NameStr);
                    if q <> 0 then
                      Delete(NameStr, q, 1);
                  until q = 0;

                  Form1.Combobox1.Items.Add(NameStr+' >> '+EmailStr);
                  end;
                end;
            end;
          end;
       end;
     end;
     finally
     // if Length(Result) > 0 then
            RDI.Free;
         Profiles.Free;
         SubKonten.Free;
      end;
  end;
  Mit Zitat antworten Zitat