Monthly Archive for April, 2010

MFC: CButton and how ON_BN_DOUBLECLICKED message map works

Microsoft Foundation Classes (MFC) library provides CButton which, according to MSDN, can be used for creating a check box, a radio button, and a pushbutton.

There are two events CButton supports: (i) ON_BN_CLICKED (single click), (ii) ON_BN_DOUBLECLICKED (double click). Let’s assume you provide a meaningful implementation for a single click and do nothing in the event handler for the double click (empty method’s body). The result if a single click is obvious, but what will happen if user double clicks the check box (or the other CButton representation)? There are two possible answers (assuming the check box was unchecked initially):

  1. Check box will be checked, and then unchecked – a simulation of a double (single) click
  2. Check box will be checked only – one action takes place now

Continue reading ‘MFC: CButton and how ON_BN_DOUBLECLICKED message map works’

TFS vs. Subversion

Update, 2010-10-23 Note: After reading discussion on Martin Hinshelwood’s blog, I’ve decided to state clear I’m writing here about TFS 2008. Some of the points might not be relevant to TFS 2010.

I’ve been using both Subversion and Team Foundation Server (TFS). Because I first used Subversion and started using TFS afterwards, I had to get used to TFS flavors. I think TFS is great but to be honest there were a few things I missed from Subversion and a few things that really annoyed me when I started using TFS.

So, this is a list of strong and weak points of TFS from the perspective of a developer who switched to it after using Subversion.

Continue reading ‘TFS vs. Subversion’

Windows Error Reporting – first steps in postmortem debugging – how to collect mini dump?

Note: What is described below applies to Windows Vista x64 (at least I used such OS). I’m not going to describe what to do with a mini dump – how to analyze it in a debugger (e.g. in Visual Studio); such information can be found in a very good article at CodeProject. What I’m going to present here is how to set up Windows Vista so that mini dumps are created when an application crashes, and enforce they are stored locally on the machine on which that happened.

I believe every developer uses debugger while product creation. However it’s also possible to debug the application after it’s delivered to the client. One of such techniques is postmortem debugging – the act of debugging the memory dump of a process, which is stored in a special file (not human readable).

Microsoft has created a special service – Windows Error Reporting. Prior to Vista, Dr. Watson was default Windows application debugger that created crash dumps. Starting with Vista, Microsoft has replaced Dr. Watson with a new, improved mechanism. In short (supposing Windows Error Reporting is enabled), if an application crashes a mini dump (representation of the state of the process) is created. Mini dump is much smaller but still provides plenty of needed information. Depending on settings, a mini dump can be sent to Microsoft for further analysis. This is default behavior which, at least in my case, resulted in no mini dumps stored locally on the machine where the crash took place.

Continue reading ‘Windows Error Reporting – first steps in postmortem debugging – how to collect mini dump?’