Dump file

This blog entry deals with user mode dumps only. Kernel mode dump files is not dealt with here but should be quite similar. Define dump file It is the memory snapshot of a process. The dump file saves all information pertaining to a process. The information include, loaded modules/dlls, handles, executing threads and other stuffs. Optionally we can […]
Continue reading…

 

Debugging WM_PAINT messages

It’s always irritating to debug paint messages and sometimes expensive too. I’ve tried different methods to try debug painting issues, always ended up disappointed. Why is it such a pain to debug WM_PAINT messages? Main reason is, we are not in control. Paint messages comes via a window framework. Painting is done whenever a window […]
Continue reading…

 

DEBUG_NEW explained

mm so what the heck is this DEBUG_NEW? Does this harm my application? Why is DEBUG_NEW provided? These are some of the questions that people have always asked when they see the following statements in a .cpp file of an MFC application… [sourcecode language=”cpp”]#ifdef _DEBUG   #define new DEBUG_NEW   #undef THIS_FILE   static char […]
Continue reading…

 

Seeing array values in the debugger as a list!

VC debuggger has a nice feature to display array values. It works with any contiguous data, for e.g. vector, CArray, native type arrays etc. Follow these steps… IntVector is an array of integers Start quick watch by pressing Shift + F9 with IntVector object selected Select _First(encircled in red) and press Add watch(encircled in red) […]
Continue reading…

 

Dumping CObject based array!

Ever felt the need to dump an MFC array content to a debugger, it’s just so easy! Use AfxDump or afxDump! Here is an e.g. [sourcecode language=’cpp’]CArray IntArray; AfxDump( &IntArray ); // Or #ifdef _DEBUG afxDump
Continue reading…

 

GetIconInfo caveat!

I had heavy resource leaks in my resource digger application with my resource leak detector showing ever increasing amount of bitmap handles! As a hint to me this was happening in my icon display function, but looking up the code I found nothing causing a leak. Analyzing closely I found that bitmap count was increasing […]
Continue reading…

 

AfxTrace trick!

Ever felt the need for a simple thing like, you print something to developer studio output window and when you double click on that line it takes us to the place from where this was output. For eg: You have an unknown exception and you put a trace statement which prints the file name and […]
Continue reading…

 

Conditional compilation and conditional inclusion of a resource!

Hope you’ve heard of conditional compilation. Conditional compilation simply means what it says, i.e. compile only when a certain condition is true and it’s only meant for the compiler hence it should only take place during compilation. We do conditional compilation with help of preprocessor commands. For eg: [sourcecode language=’cpp’]void WhoIsNibu() {     // 😉 […]
Continue reading…