Solved

WebBrowser- using the Find command

Posted on 1998-08-31
6
183 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
Technology Partners: 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

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!

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

726 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