on 03-06-2014 6:00 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.