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)
Disadvantage: In this option the formatting toolbar is not available.
Option 2: Changing the default signature on any new message
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 DesktopBobDisadvantage
: 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.
- 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.
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.
It's a simple application. I have used the
class for the
and it contains the Quotes which is derived
. I wrapped these two classes into a class library.
public class QuotesCollection : CollectionBase
public class Quotes : Object
The main reason for using
as base class because of it's it supports these interfaces
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.
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
"<FONT face=Tahoma color=blue size=4><STRONG>I was raised in the
<STRONG>The west of Texas</STRONG>. <FONT face="Fine Hand"
It's </STRONG><FONT face=Verdana
color=green><U>pretty close to California.</U></FONT></FONT></FONT>
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="http://www.latimes.com">%20 los/ Angeles Times</A>,
April 8, 2000</STRONG></FONT></EM> </P>
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.
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.
- From Outlook go to the Tools menu, click Options, and then click the Mail Format tab.
- In the Send in this message format box, click the message format (Plain Text or HTML) you want to use the signature with.
- Choose 'CPQSig' from the 'Use this Signature by default' combo box under the Signature group.
- Disabled the context menu in HTML Control.
- When the app is closed the tray icon won't disappear immediately from the Taskbar Notification area.
- HTML copy options require the focus in the HTML tab.
- 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)
- 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!
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
- Added option of opening a quote collection from web in the File -> Open menu.
- Open Collection from Web dialog
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:
- The "Random" function doesn't updating the quotes count properly.
- Copy sub menu items ordered properly.
- 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
Under Construction. Please check back later.