Click here to Skip to main content
15,920,513 members
Articles / Programming Languages / C#

CodeProject Quoter

Rate me:
Please Sign up or sign in to vote.
4.90/5 (28 votes)
23 Jun 20036 min read 167.9K   1.1K   71   26
Simple tool for storing and retrieving the quotes and using them in the signatures.

CP Quoter - Main Form with HTML View - jpgCP Quoter - Main Form with HTML Source - jpg


Notice : This is not an article, but a simple tool for serious CPians who use the quotes in their signatures. To be frank I doubt you will learn anything new here.

Any frequent visitor to Lounge or Message boards would have observed the amazing quotes used by fellow CPians in their signatures. The fun part is most of these quotes are from the messages posted by none other than fellow CPians! And some folks often change their signatures with the new quotes frequently.

I tried to do the same. But it's kinda of tough with the current CP's signature option. Following are the 3 options I tried. Two of the options are from CP and the remaining one from DesktopBob application.

Option 1: Default signature for all the messages (My Profile -> My Settings)

'CPQ - Signature option via Settings - jpg

Disadvantage: In this option the formatting toolbar is not available.

Option 2: Changing the default signature on any new message

CP - Signature option - jpg

Disadvantage: You can't preview instantly. For that you have to use the 'Preview' button. Even after your modifications and when you ready to post sometimes you get the CP's easter egg "The operation failed unexpectedly. Please try again."

Option 3: Changing the default signature on any new message via DesktopBob

Disadvantage: There is no GUI to add the quotes to signature XML file. So you have to open the XML file and add each quote one by one.

Option 4: :-)

Just Kidding. Enough bragging.

So then comes CPQ, easy way to store the quotes (XML format) and retrieve them and use these quotes with in the signatures so that it can used in CP, DesktopBob and Outlook.

Key features

  • All the quotes are stored in the XML file.
  • Multiple collections of quotes. (Ex: CPiansQuotes.html, DubyaQuotes.html)
  • HTML support for the quotes (like Bold, Underline, URL support)
  • Add and Remove quotes from a collection.
  • Random quote from a collection.
  • HTML Source option for the quote.
  • Copy the quotes to Clipboard in Text and HTML format.
  • Copy the quotes to Outlook signatures location in Text and HTML format.

Original Idea

One of my ex-colleague James Huckaby developed a similar tool (with no HTML and XML support) in VC++ but with more bells and whistles.

Technical Details

Class Library

It's a simple application. I have used the CollectionBase class for the QuotesCollection and it contains the Quotes which is derived Object. I wrapped these two classes into a class library.
  • public class QuotesCollection : CollectionBase
  • public class Quotes : Object
The main reason for using CollectionBase as base class because of it's it supports these interfaces IList, ICollection and IEnumerable.


For the GUI part I have used the HTMLEditor which is a wrapper for MSHTML, the rendering portion of Internet Explorer (and IE's largest single component). It is written by Tim Anderson in C#.

Note: The "HTML Editor" requires Microsoft.Mshtml.dll Primary Interop Assembly. VS.Net installs this in Program Files\Microsoft.Net\Primary Interop Assemblies.

I have used few <A href="">command identifiers</A> to pass them as parameters to <A href="">IHTMLDocument2::execCommand</A> which executes the command on the current HTML document.

I am not a good narrator like Marc Clifton or Mike Dunn, as my grammar sucks. So why don't you guys go through the code and see what I did.

How to use this tool

The GUI is very simple. Just run the app, add all the quotes via Edit -> Add new quote.. menu item(shortcut Ctrl + Q). The new added quote will be displayed under "Quote" tab, which is an actually a HTML Editor. So if you want HTMLize the quote then use the available options (font name, size, color...etc..) from the toolbar.

To see the "HTML Source", click on HTML tab. If you want to use the HTMLized quote, just copy the from text within BODY HTML tags from textbox control under the HTML Tab. There are more options under Edit->Copy menu.

CPQ- Copy options jpeg


Actual Quote:(George W Bush)

"I was raised in the West. The west of Texas. It's pretty close to California. In more ways than Washington, D.C., is close to California."
--Los Angeles Times, April 8, 2000

HTML Source

<P align=center>
"<FONT face=Tahoma color=blue size=4><STRONG>I was raised in the 
<STRONG>The west of Texas</STRONG>. <FONT face="Fine Hand" 
color=black><FONT size=4><STRONG>
It's </STRONG><FONT face=Verdana 
color=green><U>pretty close to California.</U></FONT></FONT></FONT>
<FONT face=Verdana 
color=red size=4><STRONG>In more ways than Washington, D.C., 
is close to California.</STRONG></FONT>" --<EM>
<FONT face=Harrington color=fuchsia 
<A href="">%20 los/ Angeles Times</A>, 
April 8, 2000</STRONG></FONT></EM> </P>

HTMLized Quote

I was raised in the West.The west of Texas.It's pretty close to California.In more ways than Washington, D.C., is close to California."--Los Angeles Times, April 8, 2000

Desktop Bob users

I have the used the same XML format DesktopBob uses for it's signature rotation tool.

So add all favorite quotes via CPQ and feed the whole XML file to DesktopBob.

CPQ - XML Format style

Outlook users (version 2000)

With the CPQ, you can direct your quotes to Outlook signatures location.
Choose the quote you want for Outlook and copy it to Outlook via Copy -> Quote to Outlook (HTML) or Quote to Outlook (Text) menu options.

  1. From Outlook go to the Tools menu, click Options, and then click the Mail Format tab.
  2. In the Send in this message format box, click the message format (Plain Text or HTML) you want to use the signature with.
  3. Choose 'CPQSig' from the 'Use this Signature by default' combo box under the Signature group.

CPQ - Outlook options jpg


  1. Disabled the context menu in HTML Control.
  2. When the app is closed the tray icon won't disappear immediately from the Taskbar Notification area.
  3. HTML copy options require the focus in the HTML tab.
  4. When you select the font size in the Font Dialog it needs to be in sync with the HTML style. (Ex: Use the size less than 3 or 4)

 Thanks to

To-do List

  • Writing the random quote to Outlook signatures location on a timer.
  • MDI Support
  • Spell Check support.
  • Option to turn off to the HTML. It's for those who don't like HTML formatting.
  • Fix the bugs found by you.

Last but not the least

This is my first project at CP, that too my first managed project. Don't be scared from my MFC habit of coding. If you find any bugs(which you will), or if you have some enhancement suggestions, just post a message on this page. I hope you enjoy CPQ!

Updates History

06/24/2003: 1.1 Release

  • Added new menu options for the tray icon.
  • Random quote which is equal to Random Quote + Copy Quote to Clipboard (Text)
  • Add new quote
  • Open collection

    CPQ - Tray Icon option jpg

  • Added option of opening a quote collection from web in the File -> Open menu.

CPQ - Open options jpg 

  • Open Collection from Web dialog

CPQ - Open options jpg 

Tip: Just for fun, enter CP's RSS feed here ;)

  • Added code for checking for pre-requisites
    • Check for .NET Framework
    • Check for Visual Studio.NET
  • Added support for copying the whole XML file to DesktopBob and AutoSig application locations.
  • Used a new form for Config options and stored them in the config (XML) file.

06/03/2003: Second Release

Fixed the following bugs:

  1. The "Random" function doesn't updating the quotes count properly.
  2. Copy sub menu items ordered properly.
  3. Adding new quote shows up properly in the HTML Editor control.

Found new bug in the new quote dialog, it's messing up the newly added quote. I will fix it later, so for time being I commented that code.

06/03/2003: First Release


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Written By
Product Manager
United States United States
Under Construction. Please check back later.


Comments and Discussions

GeneralCa not run demo! Pin
manjeeet26-Jul-10 20:53
manjeeet26-Jul-10 20:53 
GeneralSystem.Runtime.InteropServices.MarshalDirectiveException Pin
Francofu27-Jul-07 7:31
Francofu27-Jul-07 7:31 
GeneralGood one. Pin
Dennis Sands27-Jan-07 7:17
Dennis Sands27-Jan-07 7:17 
GeneralShow of ball (show de bola) Pin
Palladino9-Apr-05 4:25
Palladino9-Apr-05 4:25 
GeneralGreat work! Pin
BlackDice7-Dec-04 6:54
BlackDice7-Dec-04 6:54 
GeneralRun error Pin
joannelai27-Sep-04 18:48
joannelai27-Sep-04 18:48 
GeneralRe: Run error Pin
John4u821-Feb-05 8:10
John4u821-Feb-05 8:10 
GeneralRe: Run error Pin
John4u82-Mar-05 12:10
John4u82-Mar-05 12:10 
GeneralRandom Quote Outlook XP Add-In Pin
SeshaKiran23-Dec-03 10:09
SeshaKiran23-Dec-03 10:09 
GeneralVersionCheck() Pin
Jörgen Sigvardsson6-Nov-03 13:29
Jörgen Sigvardsson6-Nov-03 13:29 
GeneralUnicode for this Pin
Dao Tran Minh8-Jul-03 21:44
Dao Tran Minh8-Jul-03 21:44 
GeneralRe: Unicode for this Pin
Anonymous19-Nov-03 10:55
Anonymous19-Nov-03 10:55 
Question&quot;Married with Children&quot;? Pin
Uwe Keim4-Jun-03 0:27
sitebuilderUwe Keim4-Jun-03 0:27 
AnswerRe: &quot;Married with Children&quot;? Pin
Vladimir Afanasyev4-Jun-03 1:39
Vladimir Afanasyev4-Jun-03 1:39 
AnswerRe: "Married with Children"? Pin
Kant4-Jun-03 3:42
Kant4-Jun-03 3:42 
AnswerRe: &quot;Married with Children&quot;? Pin
Michael Dunn5-Jul-03 6:04
sitebuilderMichael Dunn5-Jul-03 6:04 
GeneralRandom Bug fix Pin
Kant3-Jun-03 12:03
Kant3-Jun-03 12:03 
GeneralRe: Add bug fix Pin
Kant3-Jun-03 13:00
Kant3-Jun-03 13:00 
GeneralRe: Random Bug fix Pin
Rama Krishna Vavilala3-Jun-03 15:43
Rama Krishna Vavilala3-Jun-03 15:43 
GeneralRe: Random Bug fix Pin
Kant3-Jun-03 16:53
Kant3-Jun-03 16:53 
GeneralRe: Random Bug fix Pin
Prakash Nadar19-Feb-04 6:43
Prakash Nadar19-Feb-04 6:43 
GeneralRe: Random Bug fix Pin
p daddy2-Jul-03 0:48
p daddy2-Jul-03 0:48 
GeneralGot my 5 Pin
Nish Nishant3-Jun-03 11:02
sitebuilderNish Nishant3-Jun-03 11:02 
GeneralRe: Got my 5 Pin
Kant3-Jun-03 12:04
Kant3-Jun-03 12:04 
GeneralRe: Got my 5 Pin
LK0013-Apr-04 14:27
LK0013-Apr-04 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.