AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Benutzer-Mailadresse aus Netscape- bz. Opera-Mail
Thema durchsuchen
Ansicht
Themen-Optionen

Benutzer-Mailadresse aus Netscape- bz. Opera-Mail

Ein Thema von FriFra · begonnen am 2. Okt 2003 · letzter Beitrag vom 2. Okt 2003
Antwort Antwort
Benutzerbild von FriFra
FriFra

Registriert seit: 19. Apr 2003
1.291 Beiträge
 
Delphi 2005 Professional
 
#1

Re: Benutzer-Mailadresse aus Netscape- bz. Opera-Mail

  Alt 2. Okt 2003, 10:46
Also Opera ist gelöst ... jetzt fehlt noch Netscape!

Es kann ja mal ein Opera-Mail User den folgendenn Code Testen:
Delphi-Quellcode:
  function GetOperaMail(DisplayName: boolean): string;
    function GetOperaDir: string;
    var
      RDI: TRegistry;
      Suf: string;
      n: integer;
    begin
      RDI := TRegistry.Create;
      try
        RDI.RootKey := HKEY_CURRENT_USER;
        RDI.OpenKey('SOFTWARE\Opera Software', False);
        for n := -1 to 10 do
        begin
          if n = -1 then
            Suf := ''
          else
            Suf := IntToStr(n);
          if RDI.ValueExists('Last Directory' + Suf) then
          begin
            Result := RDI.ReadString('Last Directory' + Suf);
            if copy(Result, Length(Result), 1) <> '\then
              Result := Result + '\';
          end;
        end;
      finally
        RDI.Free;
      end;
    end;
    function GetAppdataDir: string;
    var
      shellMalloc: IMalloc;
      ppidl: PItemIdList;
    begin
      ppidl := nil;
      try
        if SHGetMalloc(shellMalloc) = NOERROR then
        begin
          SHGetSpecialFolderLocation(Self.Handle, CSIDL_APPDATA, ppidl);
          SetLength(Result, MAX_PATH);
          if not SHGetPathFromIDList(ppidl, PChar(Result)) then
            raise exception.create('SHGetPathFromIDList failed : invalid pidl');
          SetLength(Result, lStrLen(PChar(Result)));
        end;
      finally
        if ppidl <> nil then
          shellMalloc.free(ppidl);
      end;
      if copy(Result, Length(Result), 1) <> '\then
        Result := Result + '\';
    end;
    function GetAccountsINI(Path: string): string;
    var
      search: TSearchRec;
      directory, Tmp: string;
    begin
      Result := '';
      directory := ExtractFilePath(Path);

      // find all files
      if (pos('opera', LowerCase(Path)) > 0) then
        if (FileExists(Path) = True) then
          Result := Result + ';' + Path;

      // Subdirectories/ Unterverzeichnisse
      if FindFirst(directory + '*.*', faDirectory, search) = 0 then
      begin
        repeat
          if ((search.Attr and faDirectory) = faDirectory) and (search.Name[1]
            <> '.') and ((pos('opera', LowerCase(search.Name)) > 0) or
            (pos('opera', LowerCase(directory)) > 0)) then
          begin
            Tmp := GetAccountsINI(directory + search.Name + '\' +
              ExtractFileName(Path));
            if Tmp <> 'then
              Result := Result + ';' + Tmp;
          end;
        until FindNext(search) <> 0;
        FindClose(search);
      end;
      if copy(Result, 1, 1) = ';then
        Result := copy(Result, 2, Length(Result));
    end;
  var
    INI: TIniFile;
    AccountIni: string;
    AccountsIni: string;
    Accounts: TStringList;
    n: integer;
  begin
    Result := '';
    //alte Versionen
    AccountIni := GetAccountsINI(GetOperaDir + 'account.ini') + ';';
    while (pos(';', AccountIni) > 1) do
    begin
      INI := TIniFile.Create(copy(AccountIni, 1, pos(';', AccountIni) - 1));
      AccountIni := copy(AccountIni, pos(';', AccountIni) + 1,
        Length(AccountIni));
      try
        if INI.ReadString('SETTINGS', 'EmailAddress', '') <> 'then
        begin
          if (DisplayName = True) and (INI.ReadString('SETTINGS', 'FullName', '')
            <> '') then
            Result := Result + ', ' + INI.ReadString('SETTINGS', 'FullName', '')
              + ' <' + INI.ReadString('SETTINGS', 'EmailAddress', '') + '>'
          else
            Result := Result + ', ' + INI.ReadString('SETTINGS', 'EmailAddress',
              '');
        end;
      finally
        INI.Free;
      end;
    end;

    //aktuelle Versionen
    AccountsIni := GetAccountsINI(GetAppdataDir + 'accounts.ini') + ';';
    while (pos(';', AccountsIni) > 1) do
    begin
      INI := TIniFile.Create(copy(AccountsIni, 1, pos(';', AccountsIni) - 1));
      AccountsIni := copy(AccountsIni, pos(';', AccountsIni) + 1,
        Length(AccountsIni));
      Accounts := TStringList.Create;
      INI.ReadSections(Accounts);
      try
        for n := 0 to Accounts.Count - 1 do
        begin
          if (pos('account', LowerCase(Accounts[n])) = 1) and
            (LowerCase(Accounts[n]) <> 'accounts') then
          begin
            if INI.ReadString(Accounts[n], 'Email', '') <> 'then
            begin
              if (DisplayName = True) and (INI.ReadString(Accounts[n],
                'Real Name', '') <> '') then
                Result := Result + ', ' + INI.ReadString(Accounts[n],
                  'Real Name', '') + ' <' + INI.ReadString(Accounts[n], 'Email',
                  '') + '>'
              else
                Result := Result + ', ' + INI.ReadString(Accounts[n], 'Email',
                  '');
            end;
          end;
        end;
      finally
        INI.Free;
        Accounts.Free;
      end;
    end;
    if Length(Result) > 0 then
      Result := Trim(copy(Result, 3, Length(Result)));
  end;
Elektronische Bauelemente funktionieren mit Rauch. Kommt der Rauch raus, geht das Bauteil nicht mehr.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:22 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz