cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to chrome browser in Powerbuilder

Former Member
0 Kudos

Hi all,

I would like to connect to chrome browser instead of internet explorer.

Please find my sample code below.

IF IsWindow(il_hwnd) = 0 THEN
ioo_so_oleobject.DisconnectObject()
  li_rc = ioo_so_oleobject.ConnectToNewObject("internetexplorer.application")
  IF li_rc <> 0 THEN
  RETURN FALSE
END IF


String ls_ie
ls_ie = ioo_so_oleobject.Fullname()
  ls_ie = ioo_so_oleobject.name

If i use the below code, its not working..


li_rc = ioo_so_oleobject.ConnectToNewObject("chrome.application")

li_rc return -2(-2 = Class name not found).

Could you please suggest upon this.. (how to connect to chrome instead of IE)

Regards,

Krishna

0 Kudos

Hi Krishna,

We have the same problem.

Did you get a solution to connect powerbuilder to another browser other than Exlorer internet browser?

Thanks.

Best regards.

Yolanda

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

You did not say what you are trying to accomplish. It is not good practice to hard code to a browser. If you want to use Chrome then make it your default browser in Windows. Then hyperlinktourl in Powerbuilder and the ShellExecute API will launch Chrome.

Former Member
0 Kudos

Hi Russell,

Ideas looks good..!! Thanks..! can i have sample code on this to test.? And also, i want to do with proper error handling..!! Its possible..? (In case, if fails to open default browser(Chrome) -  Need to close the browser windows properly)

Regards,

Krishna

Former Member
0 Kudos

Hi Russell,

It's possible to check what is default browser in code..??? (For Ex: IE, Opera, Chrome) 

Regards,

Krishna

Former Member
0 Kudos

This page has a list of registry locations that record the default browser.

Use ShellExecute to launch the default Web browser

Also, if Chrome is installed, this registry location will tell you where it is located:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe

If you try loading it from PB code, leave out the Wow6432Node part. Windows will add it for you due to PB being 32bit.

Former Member
0 Kudos

It would be most helpful to know exactly what it is you are trying to accomplish. HyperlinktoURL will open a web address, ShellExecute can open local web page like a .htm file, both using the default browser.

Example, for .htm files the registry says these are "htmfile". Look that key up in HKEY_CLASSES_ROOT.

HKEY_CLASSES_ROOT\htmlfile\shell\open will tell you what Windows executes when you try to open an .htm file. For me it says IE, for you probably some command for Chrome. For just a simple key that says Chrome or IE is my default browser I've never searched for it because my application doesn't care.

Former Member
0 Kudos

Hi Russell,

HyperlinktoURL will open a link with the default browser. But I want my Application to open a link specifically in Chrome even if it is not the default browser. Is there any method to implement that.

Former Member
0 Kudos

Get the location of the Chrome browser using the registry key from my other post and then use the Run function.

Former Member
0 Kudos

Hi Roland,

Thank You Very Much. Its working fine. Now I am able to open the links in PB Application with any of the browsers. 

Former Member
0 Kudos

Hi Krishna,

When I first saw this I thought 'no way', Chrome doesn't expose an OLE interface, but a quick Google revealed something called Google Frame that has apparently just been deprecated.   Then I remembered this.…https://code.google.com/p/chromiumembedded/   I had a quick go with C# a while ago but found it hard going (my C#'s not that good). You might be able to use it but it will be some work.

Apart from it being a better (non-MS ) browser, why do you want to use Chrome? Maybe it's not worth the pain 😛

HTH, Paul

Former Member
0 Kudos

Hi Paul,

Thanks.! But our requirement is to connect to chrome browser instead IE. Do you have any other idea to connect to chrome browser.?

regards,

Krishna.

Former Member
0 Kudos

Hi Paul,

It's possible to check what is default browser in code..???

Regards,

Krishna