Einzelnen Beitrag anzeigen

Benutzerbild von erich.wanker
erich.wanker

Registriert seit: 31. Jan 2008
Ort: im schönen Salzburger Land
460 Beiträge
 
Delphi XE4 Professional
 
#4

AW: Eigenen Hyperlink erstellen (aus http:// wird myapp://)

  Alt 24. Nov 2010, 14:11
Hallo Leute,

danke für eure Tipps.

ich hab jetzt folgendes:

Delphi-Quellcode:
procedure RegisterFileType(software_protocol:String; software_name:String; software_pfad:String) ;
var
   reg:TRegistry;
   software_regedit_pfad:String;
begin
  reg := TRegistry.Create;
  try
   // Erster Eintrag
   reg.RootKey:=HKEY_CLASSES_ROOT;
   software_regedit_pfad:='';

   reg.CreateKey(software_regedit_pfad+software_protocol);
   reg.OpenKey(software_regedit_pfad+software_protocol, True) ;
   reg.WriteString('','URL:'+software_protocol+' Protocol');
   reg.WriteString('URL Protocol','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\DefaultIcon');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\DefaultIcon', True) ;
   reg.WriteString('',software_name);
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open\command');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open\command', True) ;
   reg.WriteString('',software_pfad+software_name+' %1');
   reg.CloseKey;
   // Zweiter Eintrag
   reg.RootKey:=HKEY_LOCAL_MACHINE;
   software_regedit_pfad:='Software\Classes\';

   reg.CreateKey(software_regedit_pfad+software_protocol);
   reg.OpenKey(software_regedit_pfad+software_protocol, True) ;
   reg.WriteString('','URL:'+software_protocol+' Protocol');
   reg.WriteString('URL Protocol','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\DefaultIcon');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\DefaultIcon', True) ;
   reg.WriteString('',software_name);
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open\command');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open\command', True) ;
   reg.WriteString('',software_pfad+software_name+' %1');
   reg.CloseKey;
   // Dritter Eintrag
   reg.RootKey:=HKEY_CURRENT_USER;
   software_regedit_pfad:='Software\Classes\';

   reg.CreateKey(software_regedit_pfad+software_protocol);
   reg.OpenKey(software_regedit_pfad+software_protocol, True) ;
   reg.WriteString('','URL:'+software_protocol+' Protocol');
   reg.WriteString('URL Protocol','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\DefaultIcon');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\DefaultIcon', True) ;
   reg.WriteString('',software_name);
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open', True) ;
   reg.WriteString('','');
   reg.CloseKey;

   reg.CreateKey(software_regedit_pfad+software_protocol+'\shell\open\command');
   reg.OpenKey(software_regedit_pfad+software_protocol+'\shell\open\command', True) ;
   reg.WriteString('',software_pfad+software_name+' %1');
   reg.CloseKey;

  finally
   reg.Free;
  end;

  SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil) ;


end;

Aufruf via:
RegisterFileType('http1',extractfilename(application.exename),extractfilepath(application.exename)); werds mal in den nächsten tagen auf verschiedene Maschionen testen ..

Vielen Dank

Erich
Erich Wanker - for life:=1971 to lebensende do begin ..
O
/H\
/ \

Geändert von erich.wanker (25. Nov 2010 um 13:20 Uhr) Grund: kleine Änderungen inder procedure
  Mit Zitat antworten Zitat