|
Ecco una procedura che consente di inserire un pulsante nella toolbar di Internet Explorer. Una breve spiegazione dei parametri:
1. ButtonText = Testo sotto il pulsante
2. MenuText = L'item di menu con l'indicazione del nostro programma.
3. MenuStatusbar = *Ignorato*
4. CLSID = classID univoco. Si può usare GUIDTOSTRING per creare un nuovo CLSID (per ogni pulsante).
5. Default Visible := Visualizza il pulsante.
6. Exec := Il percorso per eseguire il programma.
7. Hoticon := (Evento Mouse Over) ImageIndex in shell32.dll
8. Icon := ImageIndex in shell32.dll
Dopo aver eseguito la procedura, lanciare IE. Aprire View - Toolbars - Customize. Spostare il pulsante da "Available toolbar buttons" a "Current toolbar buttons".
~~~~~~~~~~~~~~~~~~~~~~~~~
procedure CreateExplorerButton;
const
//Stesso discorso del CLSID
TagID = '\{10954C80-4F0F-11d3-B17C-00C0DFE39736}\';
var
Reg: TRegistry;
ProgramPath: string;
RegKeyPath: string;
begin
ProgramPath := 'c:\folder\exename.exe';
Reg := TRegistry.Create;
try
with Reg do begin
RootKey := HKEY_LOCAL_MACHINE;
RegKeyPath := 'Software\Microsoft\Internet Explorer\Extensions';
OpenKey(RegKeyPath + TagID, True) ;
WriteString('ButtonText', 'Your program Button text') ;
WriteString('MenuText', 'Your program Menu text') ;
WriteString('MenuStatusBar', 'Run Script') ;
WriteString('ClSid', '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}') ;
WriteString('Default Visible', 'Yes') ;
WriteString('Exec', ProgramPath) ;
WriteString('HotIcon', ',4') ;
WriteString('Icon', ',4') ;
end
finally
Reg.CloseKey;
Reg.Free;
end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
|