0

I have a C# WinForm app with a WebBrowser control on it. I'd like to know if it is possible to add the Google Toolbar to this winform and have it interact with the webbrowser control, specifically for the "Translate" functionality. Is this possible?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Rodney Burton
  • 427
  • 8
  • 18
  • Rodney, C# does not have a webbrowser control. – John Saunders Jul 09 '10 at 19:33
  • I am using System.Windows.Forms.WebBrowser class that is included with .Net 3.5 SP1 – Rodney Burton Jul 09 '10 at 20:03
  • @John - yes it does, as Rodney has pointed out. This has been in .Net since 2.0 at least, or possibly even before that. It makes use of the IE engine. – Saajid Ismail Jul 11 '10 at 00:42
  • @Rodney - what are you trying to achieve? If you can provide more info, then perhaps we can find a better way to solve your problem, like using the Google Translate API. – Saajid Ismail Jul 11 '10 at 00:44
  • @Saajid: No, C# does not have a WebBrowser control. What makes you think it does? What's it's name? As Rodney says, it's not part of C#, it's part of .NET. They are not the same thing. – John Saunders Jul 11 '10 at 04:48
  • Please, let's not argue over technicalities, in lieu of solving my actual problem. To clarify my problem, what I have done is developed a windows application that contains a built in "browser". The browser is nothing more than a Form with a WebBrowser control on it, with buttons, address bar, etc. I need a way to translate the web page the user is currently looking at into a different language of their choice. Previously our users have used the Google Toolbar for this functionality, but we need to provide similar capability using our form. Thank you for any help/alternatives you can provide. – Rodney Burton Jul 13 '10 at 13:11

2 Answers2

2

If you want to do translation in your Windows Forms app, then perhaps you should try using a translation API.

Try this - http://googlified.com/unofficial-google-translate-api/

Saajid Ismail
  • 8,029
  • 11
  • 48
  • 56
  • Good suggestion, but could you or someone else suggest a different translation api? The uOGT api looks like it was designed to run in a web app, on a PHP server. I need a web service I can call from a windows app to do the translation of the entire web page. I am also confused about exactly how I would plug this into my app? By hooking the DocumentCompleted event, calling the translation service, then updating the DocumentText? Would that work? – Rodney Burton Jul 13 '10 at 15:15
  • Or use the Bing Translator which has a web service interface – Sheng Jiang 蒋晟 Aug 31 '10 at 23:15
0

Yes the contract between deskband and their host are defined in IE SDK. You just need to implement the same set of contracts like IE does.

However Google Toolbar is known to relay on many undocumented behavior of IE (e.g. somehow it changed the new tab page to speed dial while there is no API exists for that) so you need to simulate IE as much as you can, from Window hierarchy to COM interfaces exposed by objects to default new tab and error pages. I suggest you to contact Google for what you need to do to remain compatible to Google ToolBar, as Google's code revolves rapidly.

Sheng Jiang 蒋晟
  • 15,125
  • 2
  • 28
  • 46