Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 498073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:50:33+00:00 2026-05-13T05:50:33+00:00

I’m trying to implement some integration between a legacy app running in the Reflection

  • 0

I’m trying to implement some integration between a legacy app running in the Reflection Terminal Emulator and a browser-based app running in IE.

I’m using Host Initiated Scripts so that maintenance and deployment issues are isolated to the legacy app. All scripts will be generated in the legacy app and transmitted to Reflection using escape sequences.

I am currently able to:

  1. Launch IE
  2. Set options such as hiding toolbars
  3. Navigate to a URL
  4. Transmit status info back to the legacy app
  5. Wait for a “close” signal from the legacy app
  6. Close IE

Here’s VBA code to do that:


Sub Main
  Dim CR as String
  CR = CHR$(rcCR)
  Dim objIE as Object
  Set objIE = CreateObject("InternetExplorer.Application")
  objIE.ToolBar = false
  objIE.Navigate("http://www.google.com/")
  objIE.Visible = true
  Session.Transmit "OK" & CR
  Session.WaitForString "CLOSE", 0, rcAllowKeystrokes
  objIE.Quit
End Sub

The problem with this is that the script continues to run until it gets the close command from the legacy app.

What I want to do is use one script to launch the browser, and another to either close it or re-use it for another URL. However, I haven’t been able to find a way to save my reference to IE across script calls. Declaring objIE as Global outside Sub Main didn’t help. The Session object does persist across script calls, but it doesn’t appear to have a property that I can use for this purpose. (Session does have a UserData property, but that’s a String, not an Object.)

Here’s an example of what I’d like to do:

Script 1 – Open IE & Leave it Open:


Sub Main
  Dim CR as String
  CR = CHR$(rcCR)
  Dim objIE as Object
  Set objIE = CreateObject("InternetExplorer.Application")
  objIE.ToolBar = false
  objIE.Navigate("http://www.google.com/")
  objIE.Visible = true
  Session.Transmit "OK" & CR
End Sub

Script 2 – Send original IE window to a new URL


Sub Main
  Dim CR as String
  CR = CHR$(rcCR)
  Dim objIE as Object
  Set objIE = FindOriginalIE()
  objIE.Navigate("http://www.stackoverflow.com/")
  Session.Transmit "OK" & CR
End Sub

Script 3 – Close IE


Sub Main
  Dim CR as String
  CR = CHR$(rcCR)
  Dim objIE as Object
  Set objIE = FindOriginalIE()
  objIE.Quit
  Session.Transmit "OK" & CR
End Sub

The part that I can’t figure out is how to implement the FindOriginalIE() function used in Scripts 2 and 3.

I tried using GetObject() instead of CreateObject(), but that got me nowhere. GetObject() won’t open a new IE window, or find an existing one. I suspect this is because I’m running under Citrix, but I’m not sure.

My only leads right now are to try using IE’s hWND to reconnect to the original window, or to use DDE instead of OLE. I haven’t had much luck with either of those however, mainly because of a lack of documentation.

So, my questions are:

  1. Is what I’m trying to do possible
    using OLE? That is, is there a way
    to persist my handle to IE across
    host initiated script calls?
  2. Should I expect GetObject() to work,
    or is that a dead end?
  3. Is it possible to use the Win32 API
    in a host initiated script to
    re-connect to IE using hWND?

Any links to related articles, sample code, or other insights are greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:50:33+00:00Added an answer on May 13, 2026 at 5:50 am

    AFAIK GetObject is just not supported for the InternetExplorer object. However this is not the end:) Among many other ways you can yank it out of the windows collection of shell32. For the example code (adapted from code in the link above) to work you need to set a reference to the following:

    1. Microsoft Internet Controls
    2. Microsoft HTML Object Library
    3. Microsoft Shell Controls and Automation

    Public Sub RunMeFirst()
        Dim objIE As SHDocVw.InternetExplorer
        Set objIE = New SHDocVw.InternetExplorer
        objIE.Visible = True
        objIE.navigate "http://www.google.com/"
        Do Until objIE.readyState = READYSTATE_COMPLETE
            DoEvents
        Loop
    End Sub

    Public Sub RunMeSecond()
    Dim objIE As SHDocVw.InternetExplorer
    Dim doc As MSHTML.HTMLDocument
    Set objIE = GetIEByURL("http://www.google.com/")
    Set doc = objIE.document
    MsgBox doc.body.innerText
    End Sub

    Private Function GetIEByURL(ByVal URL As String) As SHDocVw.InternetExplorer
    Dim objShell As Shell32.Shell
    Dim objExplorer As Shell32.ShellFolderView
    Dim obj As Object
    Set objShell = New Shell
    For Each obj In objShell.Windows
    If TypeOf obj Is SHDocVw.InternetExplorer Then
    If StrComp(obj.LocationURL, URL, vbTextCompare) = 0& Then
    Exit For
    End If
    End If
    Next obj
    Set GetIEByURL = obj
    End Function

    I think it might be worth discussing what you are trying to accomplish though. Roboting IE is a pretty kludgey approach (of which I am often guilty), but there might be a better, less resource intensive way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.