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

  • Corporate e-Learning technology has a long and diverse pedigree. As far back as the 1980s, companies were adopting computer-based training to supplement traditional classroom activities. More recently, rich web-based applications have added streaming audio and video, real-time collaboration and other new tools to the e-Learning mix. At the same time, the growing availability of informal learning tools--a category that includes everything from web searches to social media posts--are having a major impact on …

  • With 81% of employees using their phones at work, companies have stopped asking: "Is corporate data leaking from personal devices?" and started asking: "How do we effectively prevent corporate data from leaking from personal devices?" The answer has not been simple. ZixOne raises the bar on BYOD security by not allowing email data to reside on the device. In addition, Zix allows employees to maintain complete control of their personal device, therefore satisfying privacy demands of valued employees and the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds