How to Add a Button to the HTML Editor Control in SharePoint 2

The HTML Editor Control (or rich text editor) in SharePoint 2007 is a pretty helpful addition to the product (assuming your users are using IE). If you would like to programmatically add your own buttons to the toolbar, you will most likely find only one or two articles from a Google search on the topic. Most links point to this page at the msdn: How to: Add a Button to the HTML Editor Field Control Unfortunately, I think this document is flawed in many ways. Because of this, the other day, I set out to actually get it working, and in the process I have simplified their example and have made it a bit more useful (hopefully). I’m not sure why their example is filled with syntax errors, contains unnecessary logic (example: always reading the second item in an array?!?!), and does not bother to reset the button to a usable state when they are ...