Plug in for IE in seperate window

Add-in Express™ Support Service
That's what is more important than anything else

Plug in for IE in seperate window
 
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Ravi,

You get __TransparentProxy because all tabs/windows work in separate processes in IE8 and later. You just need to cast __TransparentProxy to IEModule, e.g.
IEModule module = this.GetModuleByTabIndex(0) as IEModule;
if (module != null)
{
}
Posted 10 Oct, 2012 09:07:39 Top
ravinukala




Posts: 103
Joined: 2012-10-05
Hi Sergey,

I did the casting mentioned by you, still I am geting {System.Runtime.Remoting.Proxies.__TransparentProxy}.

Please help ASAP.

Also Is there any way to access iemodule in another window (not tab)?

Thanks.
Posted 11 Oct, 2012 01:58:14 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Yes, right. But now you can use '.' in order to access the IEModule public members.
Posted 11 Oct, 2012 04:39:11 Top
ravinukala




Posts: 103
Joined: 2012-10-05
Hi,

I am getting following error message while accessing public members of IEModule using "."

"Cannot obtain fields or call methods on the instance of type 'MyIEAddon1.IEModule' because it is a proxy to a remote object."

Please help ASAP

Thanks.
Posted 11 Oct, 2012 06:36:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Ravi, please publish the code that produces the error.
Posted 11 Oct, 2012 08:03:08 Top
ravinukala




Posts: 103
Joined: 2012-10-05
Hi, here is the code:

////////////////////
public class IEModule : AddinExpress.IE.ADXIEModule
{
public Form1 frm;

public void GetFormInstance()
{

if (this.GetTabIndex() == 0 && this.frm == null)
{
this.frm = new Form1();
}
else
{
IEModule _ieModule = GetModuleByTabIndex(0) as IEModule;
this.frm = _ieModule.frm as Form1; // this lines gives the error.
}

}

}

/////////////
Here GetFormInstance() is the function which checks the tab index.
If it it not 0 then it will access first tab's form and assign it to second tab's form so that single form across all tab can be accessible.

Here I am getting error like below:
"Cannot obtain fields or call methods on the instance of type 'MyIEAddon1.IEModule' because it is a proxy to a remote object."


Please help.

Thanks.
Posted 12 Oct, 2012 04:05:43 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
Hi Ravi,

The code will not work correctly. You can't pass the form instance between tabs/processes. Please change the code so that it operates simple types, like 'string', int or any value types.
Posted 12 Oct, 2012 05:48:29 Top
ravinukala




Posts: 103
Joined: 2012-10-05
Hi Sergey,

Then How can I just create one instance of separate window and access that into all iemodules of of all open windows/tabs.

Thanks
Posted 12 Oct, 2012 07:08:54 Top
Sergey Grischenko


Add-in Express team


Posts: 7202
Joined: 2004-07-05
You could do something like that:
public Form1 frm;

public void SetFormCaption(string text)
{
if (this.frm != null)
this.frm.Text = text;
}

public string GetFormCaption(string text)
{
if (this.frm != null)
return this.frm.Text;
return String.Empty;
}

public void UpdateFormInstance()
{
if (this.GetTabIndex() == 0 && this.frm == null)
{
this.frm = new Form1();
this.frm.Text = this.HTMLDocument.title;
this.frm.Show();
}
else
{
IEModule _ieModule = GetModuleByTabIndex(0) as IEModule;
if (_ieModule != null)
{
_ieModule.SetFormCaption(this.HTMLDocument.title);
}
}
}
Posted 12 Oct, 2012 08:57:59 Top
ravinukala




Posts: 103
Joined: 2012-10-05
Hi Sergey,

Thanks for your reply.
It gives me idea to achieve my goals.

Thanks.
Posted 15 Oct, 2012 05:14:36 Top