Display ADXIEAdvancedBar only in first tab

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

Display ADXIEAdvancedBar only in first tab
 
Michael Moore


Guest


We need to create a solution that can be used in IE 8 and IE 11 that will only display the ADXIEAdvancedBar in the first tab from which it was loaded and hide the menu option and / or bar for each newly loaded tab. We still want the IEModule loaded for each subsequent tab / window - just not shown.


Using your documentation, samples (ie-auto-hide-advbar-vb), and forums, we successfully pieced together a solution that stores the first loaded process, handle and thread in the HKCU...AppDataLow area of the registry. When other tabs are loaded, if their process and handle don't match the values in the registry, the bar is hidden. (The keyvalue is deleted upon the last tab closing.)


However, often when browsing using the first tab, the tab appears to dispose and some other tab with a different handle and thread takes it's place. Is there a way to link the old process, thread and handle to the new thread and handle using an event? Any other ideas to accomplish our goal?
Posted 11 Sep, 2015 11:27:26 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

Sometimes IE re-creates its tabs. We can't avoid this situation. I will send you an example that shows of how you can handle this situation.
Posted 14 Sep, 2015 04:43:46 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

I have just sent you an e-mail. Please check your inbox.
Posted 14 Sep, 2015 12:23:12 Top
Michael Moore


Guest


Sergey, Thank you for the elegant and timely code sample! The event that triggers when a tab recreates works well!

Any thoughts how we may reliably associate the old tab with the new? Is the information about the new tab passed in the event arguments or perhaps we could persist and check the process + tab position?
Posted 17 Sep, 2015 13:04:28 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

I would advise you to use the handle of the advanced bar window instead of the tab window handle. The bar handle is not destroyed when IE recreates its tabs.
Posted 18 Sep, 2015 05:58:00 Top
Michael Moore


Guest


I'm encouraged by your solution, but don't think I'm targeting the correct object. I've placed code like the snippet below in the OnConnect, OnDisconnect and OnRecreated (code you provided) events of the IEModule using the following:

Try

If Not (AdxieAdvancedBarItem1.BarObj Is Nothing) Then
Dim bar As Object = AdxieAdvancedBarItem1.BarObj
Debug.WriteLine(String.Format("Bar Handle = {0}", bar.Handle.ToString))
End If

Catch ex As Exception
Debug.WriteLine("+++++++Error+++++++")
End Try


It appears this object recreates it's handle when the tab is recreated. Would you be able to post code similar to the code above to target the correct object?
Posted 18 Sep, 2015 13:48:22 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

I will develop an example for you and will send it to you as soon as possible.
Posted 21 Sep, 2015 11:32:41 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

To implement your scenario I need to modify the code of the product. Could you please describe in more details how the bar should work? What should happen if the user closes the tab that contains the visible bar?
Posted 23 Sep, 2015 05:24:37 Top
Michael Moore


Guest


Sergey, thank you for your gracious offer to change the behavior of the product code! My sincere apologies for the delay in response.

I believe we found a solution to meet our requirements.

It appears IE will refrain from recreating the tab so long as we stay in the same domain. So, when the user arrives at a page with the desired domain, we remove the IE menu, address and tool bars. Then we set the Add-In Express bar to be visible for just that instance (which we ensure by recording the handle + thread).

So far, so good! \( ^_^)/
Posted 27 Oct, 2015 14:25:40 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Michael,

Thank you for the update. Let me know if you face any other difficulties.
Posted 28 Oct, 2015 05:00:49 Top