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: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

  • Today's "average" business in general is ever more reliant on technology and the Internet. Mobility is the most often cited business trend that has transformed the way many of us work and communicate. From an IT security perspective, this means that protection methods and tools from even a few years ago are rapidly becoming "unfit for purpose." This guide provides crucial facts to assist you in building a robust business case, meeting the demands of your business, and protecting against threats now and in the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds