Link to home
Start Free TrialLog in
Avatar of AZWolf7
AZWolf7

asked on

Implementing "Find on this page" in WebBrowser

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...

Avatar of AzraSound
AzraSound
Flag of United States of America image

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.
Avatar of AZWolf7
AZWolf7

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AZWolf7

ASKER

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!
Avatar of AZWolf7

ASKER

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!
Thanks for the points! Gladd I could help!


Cheers!®©