+ „“““ %1″“);
// using Microsoft.Win32; nicht vergessen!
/// <summary>
/// Registriert ein benutzerdefiniertes URL-Protokoll für die Verwendung mit der
/// Windows-Shell, dem Internet Explorer und Office.
///
/// Beispiel für einen URL eines benutzerdefinierten URL-Protokolls:
///
/// rainbird://RemoteControl/OpenFridge/GetBeer
/// </summary>
/// <param name="protocolName">Name des Protokolls (z.B. "rainbird" für "rainbird://...")</param>
/// <param name="applicationPath">Vollständiger Dateisystem-Pfad zur EXE-Datei, die den URL bei Aufruf verarbeitet (Der komplette URL wird als Befehlszeilenparameter übergteben)</param>
/// <param name="description">Beschreibung (z.B. "URL:Rainbird Custom URL")</param>
public void RegisterURLProtocol(string protocolName, string applicationPath, string description)
{
// Neuer Schlüssel für das gewünschte URL Protokoll erstellen
RegistryKey myKey=Registry.ClassesRoot.CreateSubKey(protocolName);
// Protokoll zuweisen
myKey.SetValue(null, description);
myKey.SetValue("URL Protocol", string.Empty);
// Shellwerte eintragen
Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell");
Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell\open");
myKey = Registry.ClassesRoot.CreateSubKey(protocolName + "\Shell\open\command");
// Anwendung festlegen, die das URL-Protokoll behandelt
myKey.SetValue(null, """ + applicationPath
Alte URL:
/snippet/eigenes-url-protokoll-registrieren/253
TOP Snippet! Genau das, was ich für ein aktuelles Projekt brauche 🙂
Danke!
Frag mal im Forum nach: dotnet-forum.de