Click here to Skip to main content
Click here to Skip to main content

CodeProject Quoter

, 23 Jun 2003
Rate this:
Please Sign up or sign in to vote.
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

Introduction

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: Smile | :)


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.

GUI

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 command identifiers to pass them as parameters to IHTMLDocument2::execCommand 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

Example

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 
West.</STRONG></FONT> 
<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 
size=4><STRONG>
<A href="http://www.latimes.com">%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

Quirks


  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 Wink | ;)

  • 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

License

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

About the Author

Kant
Product Manager
United States United States
Under Construction. Please check back later.
 
రవికాంత్

Comments and Discussions

 
GeneralCa not run demo! Pinmembermanjeet pimpale26-Jul-10 20:53 
GeneralSystem.Runtime.InteropServices.MarshalDirectiveException PinmemberCherry Fu27-Jul-07 7:31 
GeneralGood one. PinmemberDennis Sands27-Jan-07 7:17 
GeneralShow of ball (show de bola) PinmemberPalladino9-Apr-05 4:25 
GeneralGreat work! PinmemberBlackDice7-Dec-04 6:54 
GeneralRun error Pinmemberjoannelai27-Sep-04 18:48 
GeneralRe: Run error PinmemberJohn4u821-Feb-05 8:10 
GeneralRe: Run error PinmemberJohn4u82-Mar-05 12:10 
GeneralRandom Quote Outlook XP Add-In PinmemberSeshaKiran23-Dec-03 10:09 
GeneralVersionCheck() PinmemberJörgen Sigvardsson6-Nov-03 13:29 
GeneralUnicode for this PinmemberDao Tran Minh8-Jul-03 21:44 
GeneralRe: Unicode for this PinsussAnonymous19-Nov-03 10:55 
Question&quot;Married with Children&quot;? PinsitebuilderUwe Keim4-Jun-03 0:27 
AnswerRe: &quot;Married with Children&quot;? PinmemberVladimir Afanasyev4-Jun-03 1:39 
AnswerRe: "Married with Children"? PinmemberKant4-Jun-03 3:42 
AnswerRe: &quot;Married with Children&quot;? PinsitebuilderMichael Dunn5-Jul-03 6:04 
GeneralRandom Bug fix PinmemberKant3-Jun-03 12:03 
GeneralRe: Add bug fix PinmemberKant3-Jun-03 13:00 
GeneralRe: Random Bug fix PinmemberRama Krishna3-Jun-03 15:43 
GeneralRe: Random Bug fix PinmemberKant3-Jun-03 16:53 
GeneralRe: Random Bug fix PinmemberMr.Prakash19-Feb-04 6:43 
GeneralRe: Random Bug fix PinmemberPaul B2-Jul-03 0:48 
GeneralGot my 5 PineditorNishant S3-Jun-03 11:02 
GeneralRe: Got my 5 PinmemberKant3-Jun-03 12:04 
GeneralRe: Got my 5 PinmemberLK0013-Apr-04 14:27 

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

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

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 24 Jun 2003
Article Copyright 2003 by Kant
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid