...den Suchen-Dialog des TWebbrowsers anzeigen?
|
Autor:
Sr. Delphi Developer |
[ Tip ausdrucken ] | | |
uses
ActiveX;
procedure WB_ShowFindDialog(AWebbrowser: TWebbrowser);
const
CGID_WebBrowser: TGUID = '{ED016940-BD5B-11cf-BA4E-00C04FD70816}';
HTMLID_FIND = 1;
HTMLID_VIEWSOURCE = 2;
HTMLID_OPTIONS = 3;
var
CmdTarget : IOleCommandTarget;
vaIn, vaOut: OleVariant;
PtrGUID: PGUID;
begin
New(PtrGUID);
PtrGUID^ := CGID_WebBrowser;
if AWebbrowser.Document <> nil then
try
AWebbrowser.Document.QueryInterface(IOleCommandTarget, CmdTarget);
if CmdTarget <> nil then
try
CmdTarget.Exec(PtrGUID, HTMLID_FIND, 0, vaIn, vaOut);
finally
CmdTarget._Release;
end;
except
// Nothing
end;
Dispose(PtrGUID);
end;
// Example:
// Navigate to a page
procedure TForm1.Button1Click(Sender: TObject);
begin
WebBrowser1.Navigate('www.swissdelphicenter.com');
end;
// Show the Find Dialog
procedure TForm1.Button2Click(Sender: TObject);
begin
WB_ShowFindDialog(WebBrowser1);
end;
Bewerten Sie diesen Tipp:
|
|
|