on 08-23-2016 5:02 AM
I have a need where I need to call Internet Explorer using PB 12.1 classic. If IE is already opened, I want to create a new tab, not start a new instance of IE. IE might not be the default browser on the users PC.
As far as I can tell, the INET object simply calls the default browser, so I cannot rely on that.
Using a run(iexplore.exe url) works, but it will create new instances of IE, Any suggestions?
Upgrading to a later PB is not an option, using a different browser is not an option.
Something like this should work for you:
oleobject lole_ie, lole_shell, lole_shellwindows
integer i
lole_shell = CREATE oleobject
lole_shell.Connecttonewobject("Shell.Application")
lole_shellwindows = lole_shell.Windows()
For i = 0 To lole_shellwindows.Count - 1
If Pos (upper (lole_shellwindows.Item(i).FullName), "IEXPLORE.EXE") > 0 Then
lole_ie = lole_ShellWindows.Item(i)
Exit
End If
Next
IF IsValid (lole_ie) THEN
lole_ie.Navigate2 (ls_url, 2048) // open in new tab
ELSE
lole_ie = CREATE oleobject
lole_ie.Connecttonewobject("InternetExplorer.Application")
lole_ie.Navigate2 (ls_url) //no need for new tab here ?
lole_ie.visible = 1
END IF
lole_shell.Disconnectobject( )
lole_ie.Disconnectobject( )
DESTROY lole_ie
DESTROY lole_shell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Terry;
I am thinking that some sort of OLE interaction might do the trick. Have a read through Real's thoughts on this approach .... Use Internet Explorer - Real's Powerbuilder Howto
HTH
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Terry,
my first thought was OLE. I haven't had time to try this but have had plenty of success with Word and Excel....
https://msdn.microsoft.com/en-au/library/aa752084(v=vs.85).aspx
HTH, Paul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can specify 2048 as second parameter of methods Navigate and Navigate2 to open a url on a new tab. Navigate method (Windows)
But I have no clue how to connect to an existing instance of IE. ConnectToNewObject("InternetExplorer.Application") seems always to start a new instance.
It seems it is not possible to connect to an existing instance of IE using ConnectToObject. The reason is that IE instances are not available in the running object table (ROT) because of security reasons.
see this Microsoft article
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.