What is "Tom Watch Image"?
To see the contents of
HBITMAP, etc, is very important when debugging Image Processing or UI programs. Usually we can seen the contents of them by
BitBlting them to a screen DC or saving them to a file but cannot see the contents of them step by step when tracing in codes. "Tom Watch Image" can do this. It is a Devstudio addin, can view the image in
HDC, etc without requiring any additional code to be inserted into your code. You select the variable, and view it like "Quick Watch" does in Devstudio.
What is "Tom Watch Data"?
Another thing that bothers me is that VC can only watch simple array expressions, such as
pData,100, to see the 100 elements in array
pData. What I want to do is to watch the expression array like
pStructer[i].pData[j] , i = 0 to 100, j = 0 to 100, etc. The "Tom Watch Data" Addin can do such jobs for you.
Installing the Addin
Install the "Tom Watch" addin by selecting the "Tools-Customize" Menu in VC and then the "Add-ins and Macro Files" sheet. Then use the "Browse" Button to select the
In the demo project, I put some commentary in the
function. You can watch the contents of
, Complex Arrays, etc. to demonstrate the "Tom Watch" tools. Just put breakpoints at appropriate locations then run the demo. When VC breaks at the locations you can select the Tom Watch Image/Data function to watch. The following figures indicate the steps.
Fig1.view the content of memDC.m_hDC by Tom Watch Image Function
Tom Watch Image Usage
- Select the Expression, such as
m_memDC.m_hDC. The expression can be in a comment.
- Select Tom Watch Image Button
- Select the Process to be debugged. Nnormally it is selected automatically.
- Select the variable type,
HBITMAP, or ,....
- Press the Watch Button to view. If the expression cannot be evaluated (e.g. a
NULL), the watch button will be grayed.
Fig2 View Complex Expression array by Tom Watch Data
Tom Watch Data Usage
- Select Tom Watch Data Button
- Open a saved expression list, or add a new expression by pressing the "Add" button
- The "Add" Button will insert a entry in Tree List, and you can modify it to your needs by clicking it, when it will change to Edit Label mode. (
Ctrl+V, etc. cannot used, you must use the Right-Button menu to Copy, Past, Cut, and the backspace key to delete). Editting the label to empty will delete the expression.
- When in debug mode, you can Press "Refresh" to Refresh the expression value.
- Expand the tree to see elements of expression array.
The utility hasn't been fully tested due to time constraints. It is a utility to help my work. so I've tested it only in my work. I use VC6, win98. (Any Bug can send to me by email, thanks a lot)
This Addin also includes some other tools to help your work, some of them are picked from other people's article. I modified them to fit my habits. so they may not fit your habits. You can select the option button to show the options dialog, and select the "Tips on other functions" to see the tips of following functions and related Acknowledgments:
- Open Project Folder or Dos Prompt, Thanks to Mark Wickman, I learned how to program DevStudio Addins by reading his article and picking the function code from his article.
- Switch Header / Source. Thanks to Manish Pansiniya, Bhavesh Pethani, I liked the function and embedded it in my addin.
- Increase build number automatically. Thanks to Mihai Filimon. I improved the function so now a build without any modifications to code will not increment the build number.
- Insert Function prototype commentary. You should select the entire prototype if it's broken into multiple lines. If the prototype fits on a single line, you do not need to select the entire prototype, just place the caret in the line.
- Normal comment. Comment in/out a line from the beginnning (place caret in the line), comment in/out block of code from the beginning of the start line to the end of end line of your selection.
- Smart comment. Comment in/out a line from the current position. comment in a block of selection, comment out a block of selection only place the caret in the block commentary (needn't select all the block commentary text).
- Active comment. Thanks to Mihai Filimon, his article Active comments is a good idea, but it is so complex and in some situations it doesn't fit my needs, so I got a cool idea from it and picked some code from it. This active comment places all the information in a commentary line. and you can modify, copy or move easily.
- If the caret is located on a empty line, popup to insert an active commentary;
- If the caret is located on an active commentary line, follow the link;
- If the caret is located on an active commentary line, and cannot follow the link, popup to edit the commentary. I usually put a active commentary linking to MSDN to remind me of some interesting topics. To simplify migrating the active commentary between different computers, I supply a option to change the MSDN folder, if the link in active commentary cannot reached, It will try using the folder.