注册协议
procedure TMainForm.RegUrlProtocol;
var
reg: TRegistry;
begin
reg := TRegistry.Create;
try
try
reg.RootKey := HKEY_CLASSES_ROOT;
if not reg.KeyExists('\JFAppURL') then
reg.CreateKey('\JFAppURL');
if reg.OpenKey('\JFAppURL', true) then
begin
if not reg.ValueExists('URL Protocol') then
begin
reg.WriteString('URL Protocol', '');
reg.WriteString('AppUserModelId', '视频采集');
end;
end;
if not reg.KeyExists('\JFAppURL\shell\open\command') then
begin
reg.CreateKey('\JFAppURL\shell\open\command');
if reg.OpenKey('\JFAppURL\shell\open\command', true) then
reg.WriteString('', ExpandFileName(ParamStr(0)) + ' %1');
end
else
begin
if reg.OpenKey('\JFAppURL\shell\open\command', true) then
begin
if reg.ReadString('') <> ExpandFileName(ParamStr(0)) + ' %1' then
begin
reg.WriteString('', ExpandFileName(ParamStr(0)) + ' %1');
end;
end;
end;
except
end;
finally
freeAndNil(reg);
end;
end;
注册完成后,在浏览器输入jfappurl://open