Come crei il tuo moniker (protocollo URL) sui sistemi Windows?
Domanda
Come crei il tuo moniker personalizzato (o protocollo URL) sui sistemi Windows?
Esempi:
- http:
- posta:
- servizio:
Soluzione
Altri suggerimenti
Ecco un vecchio codice Delphi che abbiamo utilizzato come metodo per ottenere scorciatoie in un'applicazione Web per avviare un programma Windows localmente per l'utente.
procedure InstallIntoRegistry;
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CLASSES_ROOT;
if Reg.OpenKey('moniker', True) then
begin
Reg.WriteString('', 'URL:Name of moniker');
Reg.WriteString('URL Protocol', '');
Reg.WriteString('Source Filter', '{E436EBB6-524F-11CE-9F53-0020AF0BA770}');
Reg.WriteInteger('EditFlags', 2);
if Reg.OpenKey('shell\open\command', True) then
begin
Reg.WriteString('', '"' + ParamStr(0) + '" "%1"');
end;
end else begin
MessageBox(0, 'You do not have the necessary access rights to complete this installation!' + Chr(13) +
'Please make sure you are logged in with a user account with administrative rights!', 'Access denied', 0);
Exit;
end;
finally
FreeAndNil(Reg);
end;
MessageBox(0, 'Application WebStart has been installed successfully!', 'Installed', 0);
end;
All'interno dell'OLE di Craig Brockschmidt ha probabilmente la migliore copertura sui soprannomi.Se vuoi approfondire un po' l'argomento ti consiglio di procurarti questo libro.È anche contenuto nel disco MSDN fornito con VS 6.0, nel caso lo avessi ancora.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow