Click here to Skip to main content
15,881,380 members
Articles / Programming Languages / C++
Article

Image Watch Add-in for DevStudio 6.0

Rate me:
Please Sign up or sign in to vote.
4.69/5 (14 votes)
12 Jun 20035 min read 82.4K   1.7K   36   17
A debug tool to Display the Images in CDC, HDC, HBITMAP, Data in a complex arrays, etc. just like Quick Watch in VC, without adding code to your project.

What is "Tom Watch Image"?

To see the contents of HDC, 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 TomWatch.DLL file.

Usage

In the demo project, I put some commentary in the Scribvw.cpp OnDraw() function. You can watch the contents of memDC.m_hDC, bmp.hOjbect, 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

Image 1

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, HDC, or 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

Image 2

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. (DEL, 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)

Other Functions

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.

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


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralDiscard the article Pin
ginz22-Dec-08 18:41
ginz22-Dec-08 18:41 
GeneralVery cool Pin
ETA12-Dec-06 1:37
ETA12-Dec-06 1:37 
QuestionIs it for VS.NET IDE too? Pin
rajmishra17-Dec-05 0:47
rajmishra17-Dec-05 0:47 
QuestionVrey good tools and Question: does it work on Win XP? Pin
seazi2-Jul-05 19:29
seazi2-Jul-05 19:29 
GeneralSimilar tool Pin
lars@no_spam_phobe.com4-Oct-03 23:19
susslars@no_spam_phobe.com4-Oct-03 23:19 
Cool! I wrote something similar to this several months back and tried to submit it here to code project. Unfortunately, they rejected my submission because I could not include source code (for some of the same reasons Huang is unable to). Anyway, Huang's shows CDCs, HBITMAPS while mine shows some different types of 2D image data, so I think they are probably complementary: http://www.tcfh.com/bmd/index.html
GeneralRe: Similar tool Pin
lars@no_spam_phobe.com4-Oct-03 23:21
susslars@no_spam_phobe.com4-Oct-03 23:21 
GeneralGood one... Pin
Robert Bielik12-Sep-03 2:02
Robert Bielik12-Sep-03 2:02 
QuestionFANTASTIC, but what about source code? Pin
Hofver16-Jun-03 22:11
Hofver16-Jun-03 22:11 
AnswerRe: FANTASTIC, but what about source code? Pin
HuangShansong17-Jun-03 15:01
HuangShansong17-Jun-03 15:01 
GeneralRe: FANTASTIC, but what about source code? Pin
Scott Andrew26-Aug-03 20:37
Scott Andrew26-Aug-03 20:37 
GeneralLooks great ... Pin
Gilad Novik16-Jun-03 21:02
Gilad Novik16-Jun-03 21:02 
GeneralCarry on. Pin
EIEN16-Jun-03 20:01
EIEN16-Jun-03 20:01 
GeneralAmazing Pin
Joel Holdsworth13-Jun-03 7:56
Joel Holdsworth13-Jun-03 7:56 
GeneralNotice Pin
Anonymous12-Jun-03 21:39
Anonymous12-Jun-03 21:39 
GeneralI know the feeling. Pin
WREY13-Jun-03 4:44
WREY13-Jun-03 4:44 
GeneralRe: I know the feeling. Pin
HuangShansong15-Jun-03 16:59
HuangShansong15-Jun-03 16:59 
QuestionVS.NET? Pin
Nicolas Bonamy12-Jun-03 20:01
Nicolas Bonamy12-Jun-03 20:01 

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

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