Code: Alles auswählen
;##########################
;Eigenes URL-Protokoll registrieren
;##########################
EnableExplicit
Define StringBuffer$, ProgramName$, ProgramPath$, ProtokollName$
Define NewKey, KeyInfo
; -- Dieser Code braucht Administrator Rechte!
; -- Name des URL-Protokolls
ProtokollName$ = "test"
; -- Absoulten Pfad der Datei (geg. Parameter anhängen)
ProgramPath$ = "C:\Windows\System32\notepad.exe"
Procedure Set_Reg_URL_Protokoll_Value(ProtokollName$, ProgramPath$ )
Protected NewKey, KeyInfo
Protected StringBuffer$
If RegCreateKeyEx_(#HKEY_CLASSES_ROOT, ProtokollName$, 0, 0, #REG_OPTION_NON_VOLATILE, #KEY_ALL_ACCESS, 0, @NewKey, @KeyInfo) = #ERROR_SUCCESS
; -- Warscheinlich nicht schoen geloest, schreibt in den Root vom neuen Protokoll Wichtige Daten hinein
RegSetValueEx_(NewKey, "URL Protocol", 0, #REG_SZ, "", 1)
RegCloseKey_(NewKey)
RegCreateKeyEx_(#HKEY_CLASSES_ROOT, ProtokollName$+"\shell\open\command", 0, 0, #REG_OPTION_NON_VOLATILE, #KEY_ALL_ACCESS, 0, @NewKey, @KeyInfo)
; -- "%1" Sendet den Pfad der Datei an das Programm als Parameter
StringBuffer$ = Chr(34) + ProgramPath$ + Chr(34)+" "+Chr(34) + "%1" +Chr(34)
RegSetValueEx_(NewKey, "", 0, #REG_SZ, StringBuffer$, Len(StringBuffer$) + 1)
RegCloseKey_(NewKey)
ProcedureReturn 1
Else
ProcedureReturn 0
EndIf
EndProcedure
Debug Set_Reg_URL_Protokoll_Value(ProtokollName$, ProgramPath$)
Viel spass damit
Feedback erwünscht