whats new ¦  programming tips ¦  indy articles ¦  intraweb articles ¦  informations ¦  links ¦  interviews
 misc ¦  tutorials ¦  Add&Win Game

Tips (1548)

Database (90)
Files (137)
Forms (107)
Graphic (116)
IDE (21)
Indy (5)
Internet / LAN (131)
IntraWeb (0)
Math (76)
Misc (127)
Multimedia (45)
Objects/
ActiveX (51)

OpenTools API (3)
Printing (35)
Strings (83)
System (268)
VCL (243)

Top15

Tips sort by
component


Search Tip

Add new Tip

Add&Win Game

Advertising

13 Visitors Online


 
...invoke the 'find' dialog in a TWebBrowser?
Autor: Sr. Delphi Developer
[ Print tip ]  

Tip Rating (4):  
     


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;

 

Rate this tip:

poor
very good


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners