Solved

Implementing "Find on this page" in WebBrowser

Posted on 2000-05-08
6
832 Views
Last Modified: 2012-06-21
I need to implement the "Find on this page" dialog for the WebBrowser control. I have tried the following, and neither works correctly:

First, I tried sendkeys:
   Me.WebBrowser1.SetFocus
   SendKeys "^F"

This worked for a while, but I had to implement an interface to trap the right click on the menu. Doesn't seem to work anymore.

Second, I tried the ExecWB method. However, this method brings up the Find File method instead.
ActiveForm.WebBrowser1.ExecWB OLECMDID_FIND, OLECMDEXECOPT_DONTPROMPTUSER

Bonus points if you can indicate how to implement "Find Next (F3)" functionality...

0
Comment
Question by:AZWolf7
  • 3
  • 2
6 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2789807
i think trying to find a way to use sendkeys is your best bet...let ie take care of using it...another expert and myself have been attempting to show the find and/or replace dialog ourselves through code but we can't keep it from crashing our programs. there are several pieces of code in C that show how to do it but we have been unable to duplicate it in vb.
0
 

Author Comment

by:AZWolf7
ID: 2789840
I have some C++ code which used the IOleCommand interface, but alas, can't seem to implement it. If I do find it, I'll post it here.
0
 
LVL 14

Accepted Solution

by:
mcrider earned 100 total points
ID: 2790943
This works every time for me...

   WebBrowser1.SetFocus
   SendKeys "^f", True


You MUST send the ^f as lowercase... ^F doesn't work.


Cheers!®©
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:AZWolf7
ID: 2793183
Still didn't take care of all the problems when you implement IDocHostUIHandler, but such a simple solution that works! I guess it is the simeple things that gey ya.. *grin*
thanks!
0
 

Author Comment

by:AZWolf7
ID: 2793185
Still didn't take care of all the problems when you implement IDocHostUIHandler, but such a simple solution that works! I guess it is the simeple things that get ya.. *grin*
thanks!
0
 
LVL 14

Expert Comment

by:mcrider
ID: 2794642
Thanks for the points! Gladd I could help!


Cheers!®©
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now