Convert message ID to a string

I've always wanted something to do this, but never got around to doing it. Well I found code deep in the mfc that does what i wanted, but i had to cut and paste it cause its not really reusable. Any this is how you use it:
CWindowsMessageToString msgConverter; 
LPSTR lpszMsg = msgConverter.GetStringFromMsg( WM_COMMAND ); 
MessageBox( lpszMessage ); 

This would pop up a messagebox that would say "WM_COMMAND".
I think this class will be useful when you have a function that is handling many messages like PreTranslateMsg. You can also pass 0 as the second parameter to GetStringFromMsg to prevent the function from returning strings for frequently send message.

Download source - 2KB

Date Posted: 08/27/98



Comments

  • Decoding window messages

    Posted by Legacy on 06/19/1999 12:00am

    Originally posted by: Jay Bazuzi

    If you want to decode a window message in the debugger, you can use the ",wm" format specifier in watch and quickwatch. Like this:

    uMsg,wm

    and you'll get things like "WM_COMMAND".

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • One of the most foolproof ways for an online system to confirm, "Is it really you?" is by adding two-factor authentication. Modern two-factor solutions have evolved to support new, complex technology models that change how we use data, including cloud computing and bring-your-own-device (BYOD). However, not all two-factor authentication solutions are created equal. This guide walks through some of the key area of differentiation between two-factor authentication solutions and provides some concrete criteria …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds