Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <map>
  2.  
  3. // The define map could probably be made part of CWindowsMessageToString
  4.  
  5. static std::map<int, const TCHAR*> defineMap
  6.  
  7. #define DEFINE_MESSAGE(wm) defineMap.insert( pair<int, char*>(wm, TEXT(#wm)) )
  8.  
  9. CWindowsMessageToString::CWindowsMessageToString()
  10. {
  11.     DEFINE_MESSAGE(WM_CREATE);
  12.     DEFINE_MESSAGE(WM_DESTROY);
  13.     DEFINE_MESSAGE(WM_MOVE);
  14.     DEFINE_MESSAGE(WM_SIZE);
  15.     // ...
  16. }
  17.  
  18. TCHAR *CWindowsMessageToString::GetStringFromMsg( DWORD dwMessage, bool bShowFrequentMessages )
  19. {
  20.     //...
  21.     if (defineMap.find(dwMessage))
  22.     {
  23.         return defineMap[dwMessage];
  24.     }
  25.     return NULL;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement