problem with ((mshtml.HTMLHeaderElementClass)(anchor)) when install

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

problem with ((mshtml.HTMLHeaderElementClass)(anchor)) when install
Laveena James

Posts: 7
Joined: 2010-09-16

I have used following code to find the achor tag inside h3 tags in the page content. It is working fine in development system (ad-in express installed)

When i create the set up files and installed in another system it doesnt work.

Codes are here:

foreach (mshtml.HTMLElementCollection anchor in HTMLDocument.getElementsByTagName("h3"))

What is wrong with my code here ? can you please help us.

Thanks for your help.
Posted 22 Sep, 2010 08:24:31 Top
Eugene Astafiev

Add-in Express team

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

Please try to debug the add-on on the target PC (or just print debug messages).

Anyway, I don't recommend using the foreach loop in the code of add-ins. That way you don't release underlying COM objects. Please use the for loop instead. Also you need to use the System.Runtime.InteropServices.Marshal.ReleaseCOMObject function for releasing underlying COM objects.
.NET, Extended MAPI, Windows Phone & RT
Posted 22 Sep, 2010 09:22:39 Top
Laveena James

Posts: 7
Joined: 2010-09-16
Hello Eugene ,

Thanks for your response.

Actually i need to find "<a>" anchor tag inside the "<h3>" tags in the page content.

My query is, i had find the solution for this and get the anchor tags and h3 tags. It is working in debugging stage.

Once i create the setup files it doesnt work.

So is there any way to resolve this or any idea to get the anchor tags inside the h3 tags.

Actually i couldnt get how to do that by this code.


Can you please help us or give any sample codes ?
Posted 23 Sep, 2010 02:41:37 Top
princy rose

Posts: 10
Joined: 2010-09-14

I have the same issue.

I used the mshtml.HTMLElementCollection to find h3 tags. It is working fine.

But mshtml.HTMLHeaderElementClass)(anchor)) it doesnt work. Both are working in debugging mode well.

So what is the issue in my code ?
Posted 23 Sep, 2010 04:26:36 Top
Andrei Smolin

Add-in Express team

Posts: 14372
Joined: 2006-05-11
Hi Laveena and princy,

I'm terribly sorry for the delayed response; I cannot give any reason for why your questions were left unanswered.

Please note that this sort of issues (the code works on the development PC and doesn't work on the customer's) may relate to the Protected Mode; when you run IE by debugging your IE add-on from VS run via "Run as administrator", Protected Mode is off. So try turning Protected Mode off on the target and see if this helps. If positive, pay attention to HowTo: Deal with Protected Mode API in Internet Explorer 7 and IE8

Regards from Belarus (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Sep, 2010 09:02:48 Top