free hit counter "Subscribe to ..." from IE Context Menu - Nauman Leghari's Blog
Thursday, April 10, 2003 9:51 AM laghari78

"Subscribe to ..." from IE Context Menu

As more and more Rss Aggregators display the feed into hosted IE control. I personally feel it very handy to Subscribe to Rss feed from the IE context menu, instead of the 3-step process of first copying then pasting and finally clicking the subscribe button. Some of the important pieces that you can use are.

First you need to add an entry into registry (in actual scenerio it should be done using the setup builder). The Registry key is

[HKCU]\Software\Microsoft\Internet Explorer\MenuExt\[Your text].

In the default value, you need to specify the html file which is being used to handle/process the URL it receives. You are also required to define the context type. A context type denotes the resource on which you need your option to act upon. For e.g., we are only interested in handling right click on URLs. So, we specify the context value as 34(Hex 22) which is used for only hyperlinks.

[Please let me know of any document(s) describing these context types.]

The next step is to handle the URL into the html document you specified and Instantiate an object of your .NET component from JScript and call any public method. That should do the trick for you. To make your .NET component accessible from Jscript,  remember to “regasm” it with /codebase switch.

I didn’t know about this until Adam Sills from DOTNET-CLR list point me into right direction.

Create a .net DLL project. In the source file, write the following code. Change it to how you intend to use. Also create a strong name key for use with this file.


using System;

using System.IO;

using System.Reflection;

using System.Runtime.CompilerServices;


[assembly: AssemblyKeyFile("pluginkey.snk")]

[assembly: AssemblyKeyName("")]


namespace AggiePlugin



            /// Summary description for Class1.


            public class MainClass


                        // A public constructor is necessary

                        public MainClass()




                        public void WriteToFile(string str)


                                    // str passed into this function is the URL, here I write it into a text file

                                    // which is then read from the Aggie interface and then automatically subscribed

                                    // to each URL found.

                                    Assembly currAsm = Assembly.GetAssembly(this.GetType());

                                    string filename = Path.GetDirectoryName(currAsm.Location) + @"\temp.tmp";


                                    // write the output to a temp file

                                    StreamWriter sWriter = new StreamWriter(filename, true);










// note that there is a public default constructor

// and assembly attribute are defined because of signing with strong name key

// other methods are defined as public or private or whatever


To be able to access the .net assembly from JS, we have to regasm it with the /codebase attribute.


 regasm /codebase filename.dll


Write code into the JS file to create the object and access it.


' from VBScript

set aggie = CreateObject("AggiePlugin.MainClass")


call aggie.WriteToFile(external.menuArguments.event.srcElement)


No Comments