Jose Roca's Browser Control - Question

Started by Martin Francom, December 21, 2010, 02:36:41 AM

Previous topic - Next topic

Martin Francom

I have written a very simply program using Jose Roca's 
browser control.  This program simply opens google's translation page.  And allows quick access to phrase translation. 

My problems are:
1) that for some reason copy/paste does not work on this control.  I want to be able to copy the result of the translation and paste it into a textbox in another program.
2) The speech botton on this page also does not work when this page is displayed in Jose's browser control.

Note:  Both of these problems disappear when the webpage is displayed by IE. 

Can someone help me with these problems?     I have attached the FireFly project.
 

José Roca

Regarding the copy and paste problem, you need to call OleInitialize at the very beginning of the application, before the control is created, and OleUninitialize at the end.

Martin Francom

Quote from: Jose Roca on December 22, 2010, 10:42:04 AM
Regarding the copy and paste problem, you need to call OleInitialize at the very beginning of the application, before the control is created, and OleUninitialize at the end.


Jose,  Thanks, but I am not familier with those function calls cand you
be a bit more specific.  Thanks
What is the PB syntax for the call to OleInitialize and OleUnInitialize?
And where should I put the code?  In the Create Function of  FormMain?

I found this on the internet but this seems to be C+ code 
    HRESULT OleInitialize(
  __in  LPVOID pvReserved
);


José Roca

You must include Ole2.inc


#INCLUDE ONCE "Ole2.inc"


OleInitialize is called as


OleInitialize %NULL


and OleUnitialize as


OleUninitialize %NULL


Quote
And where should I put the code?  In the Create Function of  FormMain?

Ask Paul about the best place to put them. OleInitialize must be called before the WebBrowser control is created, so the Create function is too late.

Paul Squires

Quote from: Jose Roca on December 22, 2010, 04:14:48 PM
Ask Paul about the best place to put them. OleInitialize must be called before the WebBrowser control is created, so the Create function is too late.

Probably put OleInitialize in FF_WINMAIN and put OleUnInitialize in the WM_DESTROY of your main startup form.
Paul Squires
PlanetSquires Software

Martin Francom


Martin Francom

Jose,  Yes,  that worked. Copy/Paste now works. Thank you.

Do you have any suggestion how I can get the "speak" button to work when the webpage is displayed in your WebBrowser control?

It works in IE.   Here's the link to the webpage (if you would like a look):
    http://translate.google.com/#auto|es|