Essential Tool: CopySourceAsHTML

In writing any sort of code how-to you end up wanting to write code examples.

   12 

   13 // CAboutDlg dialog used for App About

   14 

   15 class CAboutDlg : public CDialog

   16 {

   17 public:

   18     CAboutDlg();

   19 

   20 // Dialog Data

   21     enum { IDD = IDD_ABOUTBOX };

   22 

   23     protected:

   24     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

   25 

   26 // Implementation

   27 protected:

   28     DECLARE_MESSAGE_MAP()

   29 };

… like this.

Enter a really cool tool: CopySourceAsHTML which was written by Colin Coller and was released by J.T. Leigh & Associates Inc.

While you can get the application at the link above, things are a bit terse at that site. An explanation of how to use CopySourceAsHTML may be found at a great page on this and other cool tools Visual Studio Add-Ins Every Developer Should Download Now from the MSDN Magazine site.

One quick hint: CopySourceAsHTML defaults to showing line numbers (if you have line number in your display). Line numbers are great in an article for indicating details to readers. Line numbers are crappy if you want to make it easy to copy/paste code so in that case, suppress the line number using the CopySourceAsHTML option before adding to your post as I did with this second snip below:

 

// CAboutDlg dialog used for App About

 

class CAboutDlg : public CDialog

{

public:

    CAboutDlg();

 

// Dialog Data

    enum { IDD = IDD_ABOUTBOX };

 

    protected:

    virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

 

// Implementation

protected:

    DECLARE_MESSAGE_MAP()

};

Comments are closed.