How to save an OLE server's handle persistently?
I am attempting to make a visual automation server (OLE) persistent in the non-persistent wold of browsers. I can successfully launch the server from IE6 using VBScript as follows:
# Code:
Dim mySrvObj
if not isobject(mySrvObj) then
Set mySrvObj = CreateObject("ImageDisplay.ImageDisplayInterface")
end if
Since browsers are not persistent, every time the browser refreshes, I lose the handle to the server. This causes the server to shut down and start up with each page refresh/submit.
I was able to accomplish this using a frame and two frame sets. The first frameset contains content. The second frameset is hidden and is also persistent. It contains the server's handle MasterSrvObj. I can refresh the handle in the content frameset from the hidden frameset as follows:
mySrvObj = parent.hidden.MasterSrvObj
This works beautifully, however, using framesets is not a very good solution.
I tried a variation of the frameset solution using two browsers. The first browser launches the application. It also launches a second browser. The second browser only function is to launch the server and store the handle (MasterSrvObj). I was hoping I could reference MasterSrvObj from the frist browser.
I've also tried the following unsuccessfully:
1. Saving the handle as a cookie.
2. Assigning the handle to a hidden text field on browser 2 to browser 1 as follows (browser 1 launched browser2):
document.self.getElementByID(srvObj).value=document.subWindow.getElementByID(MasterSrvObj).value;
This code is browser 1.
3. Tried using the the opener fuction:
window.opener.formname.textfieldname.value = MasterSrvObj in the second browser.
Question 1 Is there a way to get the server's handle using any Microsoft script, such as window.opener.returnValue = MasterSrvObj; 2008, C#, JSCript, JavaSCript, or WScript? Please speak up loudly it you have a solution!!!:):D
Question 2: If I were to launch the server first and then launch the browser second, is there a way I can get the handle of the server from the browser? That way I am not dependent on the non-persistent browser. If so, how can I do this?
Question 3: The variable mySrvObj is VarType(mySrvObj)=9. Is there a way I can can convert the handle into a numeric or string data type and save it as a cookie?
Please help. I am quickly running out of ideas and desperate!
Thanks much for taking the time to read all of this. I hope my explanation was somewhat coherent!
Thanks again.
Cheers!
Re: How to save an OLE server's handle persistently?
Here is a screen shot of the application on the right. The server on the left. Notice in the upper right corner a small IE6. This the two browser attempt.
Click thumbnail to see image.
http://img234.imagevenue.com/loc34/t...6_122_34lo.jpg