PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on December 21, 2010, 02:36:41 AM

Title: Jose Roca's Browser Control - Question
Post by: Martin Francom on December 21, 2010, 02:36:41 AM
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.
 
Title: Re: Jose Roca's Browser Control - Question
Post by: José 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.
Title: Re: Jose Roca's Browser Control - Question
Post by: Martin Francom on December 22, 2010, 01:02:27 PM
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
);

Title: Re: Jose Roca's Browser Control - Question
Post by: José Roca on December 22, 2010, 04:14:48 PM
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.
Title: Re: Jose Roca's Browser Control - Question
Post by: Paul Squires on December 22, 2010, 11:29:46 PM
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.
Title: Re: Jose Roca's Browser Control - Question
Post by: Martin Francom on December 23, 2010, 03:18:01 AM
Jose, Paul.... Thanks for the help.
Title: Re: Jose Roca's Browser Control - Question
Post by: Martin Francom on December 23, 2010, 03:35:24 AM
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|