Tab navigation

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

Tab navigation
 
Neil Armstrong


Guest


I have two tabs open in IE. Tab 1 is active. How can I change the url of Tab 0? I tried IEApp.Navigate, but it seems to change only the active tab.

Thanks,
Neil
Posted 31 Jan, 2012 02:32:37 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Neil,

You need to send a message to the instance of your add-on in that tab, see {the module}.SendMessageToInstance(). You call IEApp.Navigate as part of processing that message. In the code sample below, you'll need to use SendMessageToInstance() instead of SendMessage. See alswo the section Messaging http://www.add-in-express.com/docs/internet-explorer-addon-development.php.


private const int WM_USER = 0x0400;
private const int MYMESSAGE = WM_USER + 1000;
//...
private void adxKeyboardShortcut1_Action(object sender)
{  this.SendMessage (MYMESSAGE, IntPtr.Zero, IntPtr.Zero);  }
//...
private void IEBarModule_OnSendMessage(object sender, AddinExpress.IE.ADXSendMessageEventArgs e)
{
if (e.Message == MYMESSAGE)
{  //... }
}



Andrei Smolin
Add-in Express Team Leader
Posted 31 Jan, 2012 03:28:37 Top
Neil Armstrong


Guest


But if I use SendMessageToAll, in the relative OnSendMessage can I use the IEApp.Navigate? Are there any differences between an IEModule and IEBarModule? I noticed that the OnSendMessage does not have the sender in case of IEModule.

Thanks again.
Posted 31 Jan, 2012 05:46:46 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Neil Armstrong writes:
But if I use SendMessageToAll, in the relative OnSendMessage can I use the IEApp.Navigate?


Yes. SendMessageToInstance sends a message to the specified add-on instance, while SendMessageToAll sends a message to all add-on instances.

Neil Armstrong writes:
Are there any differences between an IEModule and IEBarModule?


They represent different IE extension types: IE add-in and IE Bar. Still they provide a similar set of methods/events.

Neil Armstrong writes:
I noticed that the OnSendMessage does not have the sender in case of IEModule.


This event doesn't provide that parameter. In case you need to pass something allowing to identify the module (=the add-on instance) which sent the message, you can pass it in the parameters of the SendMessage method e.g. if every instance of your add-on has an ID (integer), you can cast it to IntPtr and pass it in wparam or lparam parameters of the SendMessage method.

All the SendMessage/OnSendMessage machinery is developed in order to help you deal with many instances of your add-on running in different threads and processes.


Andrei Smolin
Add-in Express Team Leader
Posted 31 Jan, 2012 06:40:52 Top