Solved

WebBrowser- using the Find command

Posted on 1998-08-31
6
182 Views
Last Modified: 2010-04-04
I am using the WebBrowser. How can I implement the Find command to find a string in the web page ?
0
Comment
Question by:yvess
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1338190
I tried looking for WebBrowser in my component's pallette, but couldn't find it. Is it a 3d party component???
Anyway, can't you use
Is there a text-like in that component..like WebBrowser.Text or something similar.???
if Pos('Something', WebBrowser.text) > 0 then
  ShowMessage('Found');

Regards,
Viktor Ivanov
0
 

Author Comment

by:yvess
ID: 1338191
WebBrowser is MS ActiveX component that allows you to implement a Web browser such as IE4.  You have to import the component by going to import active X in the menu.

There is a method attach to this component but it is not obvious how to implement it. I am looking for some example on how to implement that in Delphi.
0
 
LVL 7

Accepted Solution

by:
BlackMan earned 120 total points
ID: 1338192
const
  HTMLID_FIND       = 1;
  HTMLID_VIEWSOURCE = 2;
  HTMLID_OPTIONS    = 3;


procedure TMainForm.mnuEditFindClick(Sender: TObject);
begin
InvokeIE(HTMLID_FIND);
end;


procedure TMainForm.InvokeIE(Value: Integer);
const
CGID_WebBrowser: TGUID = '{ED016940-BD5B-11cf-BA4E-00C04FD70816}';
var
  CmdTarget : IOleCommandTarget;
  vaIn, vaOut: OleVariant;
  PtrGUID: PGUID;
begin
New(PtrGUID);
  PtrGUID^ := CGID_WebBrowser;
  if WebBrowser1.Document <> nil then
   try
     WebBrowser1.Document.QueryInterface(IOleCommandTarget, CmdTarget);
     if CmdTarget <> nil then
      try
         CmdTarget.Exec( PtrGUID, Value, 0, vaIn, vaOut);
       finally
         CmdTarget._Release;
       end;
   except
    // Nothing
    end;
  Dispose(PtrGUID);
end;

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:yvess
ID: 1338193
Thank you BlackMan. Do you know of any way to do this but using my own dialog ?  I am writing a multilingual application and it would be easier that way.

Thank you.
0
 
LVL 7

Expert Comment

by:BlackMan
ID: 1338194
No, unfortunately not..
0
 

Author Comment

by:yvess
ID: 1338195
Thank you.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question