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

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

  • Companies must routinely transfer files and share data to run their business, work with partners, and speed operations. However, many find the traditional approach to file transfer lacks necessary security, is too complex and difficult to manage, does not support the levels of automation needed, and breaks down when addressing the file transfer requirements of new areas like Big Data analytics and mobile applications. This QuinStreet SmartSelect discusses how the changing business environment is making the use …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds