Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Betriebssysteme (https://www.delphipraxis.net/27-betriebssysteme/)
-   -   [Vista] Standard-E-Mail-Programm definieren/registrieren? (https://www.delphipraxis.net/112629-%5Bvista%5D-standard-e-mail-programm-definieren-registrieren.html)

Looking4Clues 24. Apr 2008 17:05


[Vista] Standard-E-Mail-Programm definieren/registrieren?
 
Vista - StandardMailProgramm registrieren

Kein Problem mit Windows < Vista;

Dickes Problem mit Windows >= Vista!

=====
Delphi-Quellcode:
procedure XPCheckForStandardEMailProgram;
var
  NativeReg: TRegistry;
  sExpected: string;
  sFound: string;
begin
  // Catch all registry exceptions and show an explanational dialog
  try
    sExpected := '"' + Application.ExeName + '" -newmail "%1"';
    NativeReg := TRegistry.Create(KEY_READ);
    // Ensure Cleanup for 'NativeReg'
    try
      NativeReg.RootKey := HKEY_CLAsSES_ROOT;
      sFound := '';
      if NativeReg.OpenKey('mailto\shell\open\command', False) then
        sFound := LowerCase(NativeReg.ReadString(''));

      if sFound = LowerCase(sExpected) then begin
        MesSageBox(0, 'MailTestApp ist bereits als Standard-E-Mail-Programm registriert.', 'MailTestApp', mb_Ok or mb_IconInformation or mb_DefButton1);
        exit;
      end;

      if sFound <> LowerCase(sExpected) then begin
        NativeReg.CloseKey;
        NativeReg.AccesS := KEY_WRITE;
        NativeReg.OpenKey('mailto\shell\open\command', True);
        try
          if MesSageBox(0, 'Soll MailTestApp als Standard-E-Mail-Programm registriert werden?', 'MailTestApp', mb_YesNo or mb_IconQuestion or mb_DefButton1)
            = mrYes then begin
            NativeReg.WriteString('', sExpected);
            NativeReg.CloseKey;
            NativeReg.OpenKey('mailto\DefaultIcon', True);
            NativeReg.WriteString('', '"' + Application.ExeName + '",0');
            NativeReg.CloseKey;
            NativeReg.RootKey := HKEY_LOCAL_MACHINE;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail', True);
            NativeReg.WriteString('', 'MailTestApp');
            NativeReg.CloseKey;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail\MailTestApp', True);
            NativeReg.WriteString('', 'MailTestApp');
            NativeReg.CloseKey;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail\MailTestApp\Protocols\mailto', True);
            NativeReg.WriteString('', 'URL:MailTo Protocol');
            NativeReg.WriteInteger('EditFlags', 2);
            NativeReg.WriteString('URL Protocol', '');
            NativeReg.CloseKey;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail\MailTestApp\Protocols\mailto\DefaultIcon', True);
            NativeReg.WriteString('', '"' + Application.ExeName + '",0');
            NativeReg.CloseKey;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail\MailTestApp\Protocols\mailto\shell\open\command', True);
            NativeReg.WriteString('', sExpected);
            NativeReg.CloseKey;
            NativeReg.OpenKey('SOFTWARE\Clients\Mail\MailTestApp\shell\open\command', True);
            NativeReg.WriteString('', '"' + Application.ExeName + '"');
          end;
        finally

        end;
      end;
      NativeReg.CloseKey;
    finally
      NativeReg.Free;
    end;
  except
    // Catch registry exceptions and inform user
    on ERegistryException do begin
      MesSageBox(0, 'Ihnen fehlen die nötigen Rechte, um das Standard-E-Mail-Programm zu ändern!', 'MailTestApp', mb_Ok or mb_IconStop or mb_DefButton1);
    end;
    // Catch other exceptions, log them and reraise them
    on localExcept: Exception do begin
      MesSageBox(0, PChar(localExcept.MesSage), 'MailTestApp', mb_Ok or mb_IconInformation or mb_DefButton1);
      raise
    end;
  end;
  Application.ProcesSMesSages;
end;
=====


Die < Vista-Registrierung klappt problemlos, ab Vista geht der Ärger damit an M$ problemlsos vorbei ;-)

Weil die Registrierung unter Vista (mit den entsrechenden Rechten) problemlos klappt!

Das Resultat ist aber leider unbrauchbarer Vista-Schrott in der Registry!

Unter Vista als Administrator mit abgeschalteter UAC getestet.

Das Resultat ist Schrott!

Hat eventuell ein hier mitlesender C-Programmierer eine Ahnung davon, was Thunderbird und dessen Installationsprogramm unter Vista wirklich tun?

RegShot 1.8.2 kenne ich schon! Meine Kiste schafft mit dem falschen Protokoll 71 Explorer :-(


mfg (mit frustrierten grüssen)


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:09 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz