Webbrowser instance

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

Webbrowser instance
Sharing a Control on the sidebar 
Shahzad Salim




Posts: 9
Joined: 2008-10-30
Hi,

I have to show an HTML page in the sidebar. I am using the WebBrowser class. I am using IE 7.

It works perfectly for the first tab (the default tab which opens up when you fire up IE). What I want to do is show the same Webbrowser control when they open the second tab. So not to reload the HTML page again but display the exact same Webbrowser control which is on the first tab. When i try to put the Webbrowser instance in the GlobalData class and try to access it for the second IE tab it throws an error

"Controls created on one thread cannot be parented to a control on a different thread".

So seems like each IE tab creates new thread for the sidebar.. Is there a way to share the control between the two threads? Please HELP!

thanks
Posted 30 Oct, 2008 23:04:22 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hi Shahzad,

There is no way to share the control. Instead, you can save the state and data of the WebBrowser control in the GlobalData class.
.NET, Extended MAPI, Windows Phone & RT
Posted 31 Oct, 2008 06:43:34 Top
Shahzad Salim




Posts: 9
Joined: 2008-10-30
Thanks Eugene.

In the case where I will need to keep the data (of the webbrowser) in sync between all the tabs how do I do the following


1) Which event do i need to capture to figure out that user opened a new IE tab?

2) How can I get the url of page of whichever tab the user is on?

3) When the user is on the second tab and he makes some changes which require me to refresh the data (in the webbrowser) on the first tab. How do I do that?

Thank You once again for you patience Eugene.

Posted 31 Oct, 2008 10:39:59 Top
Eugene Astafiev


Add-in Express team


Posts: 8540
Joined: 2007-07-25
Hello Shahzad,

1. See the OnTabCreated event of the add-on module.

2. and 3. You can use the SendMessage method (or the SendMessageToAll method) to notify other tabs or retrieve some information.
.NET, Extended MAPI, Windows Phone & RT
Posted 01 Nov, 2008 09:09:06 Top