内容摘要 -
全文 -
在浏览器中发贴子时实现自动添加贴子签名档的BHO对象设计
A browser helper object that automatically adds a different signature when you post a message to a forum
A browser helper object that automatically adds a different signature when you post a message to a CP forum
Introduction
I was inspired to write this article after seeing this article by Kant. Kant wrote a utility that allows creation of quotes collection and saving in XML format. User can chose to copy a random quote to the clipboard which can be pasted in the signature field when posting a message to a CP message board. The same feature is also available in Desktop Bob. I imagined that it would be kind of nice if a random quote automatically got into the signature field. This utility does that. When you install the utility and navigate to any url in CP from where you can post a message, the signature field is automatically filled with one of the quotes from an XML file. All you need to do is to write some quotes in an XML file either manually or using the CodeProjectQuote utility. A default XML file (copied from Kant's article) is provided with the setup and the source.
Installation and Use
Here are the steps you need to take to install and use the utility.
1. Download and extract the setup zip file
2. Double click on the AutoSigSetup.msi from Windows Explorer. You need to have windows installer 2.0 on your machine. It is very likely that your system already has it. You also need to be an administrator on the machine to install the utility.
3. Navigate to a URL in code project from where you can post a new message. The signature field is automatically filled in. Every time you renavigate (not refresh) to this page a different signature comes up. Note that your default signature will be replaced. If you want to keep your default sig just rfresh the page.
4. Obviuosly you will need to add your own quotes to the signature XML file. The default installation of the utility places an XML file named sigs.xml in the same folder as the app itself (Although this is not a very good practice in general). You can edit the file there itself.
5. If you chose you can point to a different location for the signature XML file by modifying the registry value SigFilePath under the key HKEY_CURRENT_USER\Software\CodeProject\AutoSig. The string data you place in this registry value should be the full path of the new signature XML file.
Building the Code
If instead of using the installation app you decide to build the utility yourself, you need to take the following steps.
1. Download and extract the source zip file
2. Open AutoSig2000.sln if you are using VS.NET 2002 or AutoSig.sln if you are using VS.NET 2003.
3. Build the solution.
4. Open a command prompt window and go to the output directory of the AutoSig2002 or AutoSig project
5. Type Regasm /codebase AutoSig.dll . This will register the utility.
|