Hi Fernando,
There are a number of problems with this unfortunately. When the Web Browser control has focus it doesn't forward any of the key or mouse events to Visual FoxPro. I don't think any of the solutions offered by the others here will actually work because what you have to do is capture the events inside of the browser and then forward them to the form.
In West Wind Html Help Builder I have a whole toolbar that's accessible from within the browser (for HTML editing mode). The way that I do it in there is that I implement the required HtmlDocument events and bind them to the Web Browser control. I can then capture the browser events in VFP and do what I need to. That said it's not a trivial task :-)
The interface you'll want to implement is IHtmlTextContainerEvents (you can drag and drop it out of the Object Browser for the shdocvw.dll)
DEFINE CLASS IHtmlTextContainerEvents AS RELATION OLEPUBLIC
IMPLEMENTS HTMLTextContainerEvents IN "MSHTML.TLB"
...
ENDDEFINE
The events that might be interesting to you are:
PROCEDURE HTMLTextContainerEvents_oncontextmenu() AS LOGICAL
ENDPROC
PROCEDURE HTMLTextContainerEvents_onkeydown() AS VOID
loEvent = this.oDoc.ParentWindow.Event
lnKeyCode = loEvent.KeyCode
IF lnKeyCode = 116
loEvent.keyCode = 0
RETURN
ENDIF
...
CASE lnKeyCode = 80 AND loEvent.CtrlKey
ToolClick("HTMLEdit","cmdImage")
loEvent.returnValue = .f.
ENDPROC
There's a bit more to this - specifically I created a base IE event class that has references to the form and the document and a few other things that make it easier to communicate.
I've posted the complete (implementation specific) thing here:
http://codepaste.net/r2ch7kPing me if you need more information on how this works. I've done a ton of work with this in a the past...
+++ Rick ---
>Hi,
>
>I have a form that activates a browser in it. It works just fine.
>
>Add Object oleBrowserWin as oleControl with Top = 0 , ;
> Left = 0 , ;
> Height = 380 , ;
> Width = 800 , ;
> Name = "oleBrowserWin" , ;
> OLEClass = "Shell.Explorer.2"
>
>
>The question is: I would like to put command buttons in the lower part of the form in order to execute some of the browser's functions, like when I press the right mouse button over the browser area, or ctrl+p to print etc. Think it would make life easier for some users.
>
>How could that be done?
>
>TIA
>
>Fernando