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

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds