Advertisement
Kitomas

2024-07-19 (3/13)

Jul 19th, 2024 (edited)
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 62.79 KB | None | 0 0
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. //"kit_w32\src\kit_win32\kit_Window_WindowProc.cpp":
  4. #include "kit_Window_shared.hpp"
  5. #include "kit_Window_WindowProcEvent.hpp"
  6. #include "kit_Bitmap_shared.hpp"
  7.  
  8.  
  9. using namespace kit;
  10.  
  11.  
  12.  
  13.  
  14. #if defined(_DEBUG)
  15. static void printMessage(HWND, UINT, WPARAM, LPARAM);
  16. #else
  17. #define printMessage(...) ;
  18. #endif /* _DEBUG */
  19.  
  20. LRESULT CALLBACK w32::WindowProc(HWND winHandle, UINT message,
  21.                                  WPARAM wParam, LPARAM lParam)
  22. {
  23.   //printMessage(winHandle, message, wParam, lParam); //debug thingy
  24.   Window* window = (Window*)GetWindowLongPtrA(winHandle, GWLP_USERDATA);
  25.  
  26.   if(window == nullptr){
  27.     if(message == WM_CREATE){
  28.       //set userdata to a pointer to the associated kit::Window
  29.       CREATESTRUCT* cs = (CREATESTRUCT*)lParam;
  30.       SetWindowLongPtrA(winHandle, GWLP_USERDATA, (LONG_PTR)cs->lpCreateParams);
  31.       return 0;
  32.     }
  33.     goto _dwp; //lol
  34.  
  35.   } else if(!KIT_IS_CLASS_VALID(window) && !KIT_IS_CLASS_CONSTRUCTING(window)){
  36.     _dwp: return DefWindowProcA(winHandle, message, wParam, lParam);
  37.  
  38.   }
  39.  
  40.  
  41.  
  42.   _WindowOpaque* opq = (_WindowOpaque*)KIT_GET_CLASS_OPAQUE(window);
  43.   EnterCriticalSection(&opq->lock);
  44.   LRESULT returnResult = 0;
  45.  
  46.   WindowEvent event; //will be populated by any call to KIT_HANDLE_EVENT()...
  47.   memory::set(&event, 0, sizeof(WindowEvent)); //(make sure this is done before setting anything)
  48.   event.common.type     = WINEVENT_COMMON; //...otherwise it will stay common
  49.   event.common.winIndex = opq->winIndex;
  50.  
  51.   bool switchBool  = false; //multipurpose
  52.   bool switchBool2 = true;   //^^(switchBool2 intentionally initialized to true)
  53.   u32  switchFlags = 0;      //^^
  54.  
  55.  
  56.   switch(message){
  57.     //window and canvas messages (WINEVENT_WIN_<event name>)
  58.  
  59.     //WINEVENT_WIN_CLOSE
  60.     case WM_CLOSE:
  61.     {
  62.       KIT_HANDLE_EVENT(WIN_CLOSE);
  63.  
  64.     } break;
  65.  
  66.  
  67.     //WINEVENT_WIN_MOVED
  68.     case WM_MOVE:
  69.     {
  70.       //window moved; adjust its position accordingly
  71.       opq->winRect.x = GET_X_LPARAM(lParam);
  72.       opq->winRect.y = GET_Y_LPARAM(lParam);
  73.  
  74.       KIT_HANDLE_EVENT(WIN_MOVED, opq->winRect);
  75.  
  76.     } break;
  77.  
  78.  
  79.     //WINEVENT_WIN_RESIZED
  80.     case WM_SIZE:
  81.     {
  82.       //window resized; adjust its size accordingly
  83.       opq->winRect.w = LOWORD(lParam);
  84.       opq->winRect.h = HIWORD(lParam);
  85.  
  86.       //resize canvas if it's supposed to scale with the window
  87.       if(!opq->canvasStretch)
  88.         ResizeBitmapOpaque(opq->canvas, opq->winRect.w, opq->winRect.h);
  89.  
  90.       //blit canvas to the window to reflect its new size
  91.       window->present();
  92.  
  93.       KIT_HANDLE_EVENT(WIN_RESIZED, opq->winRect);
  94.  
  95.       //tbd: make MINIMIZED, MAXIMIZED, and RESTORED events here
  96.  
  97.     } break;
  98.  
  99.  
  100.     //WINEVENT_WIN_UNFOCUSING
  101.     case WM_KILLFOCUS:
  102.     {
  103.       //if a key is released outside the client area, its key up message
  104.        //is never sent, so here the key states are reset when unfocusing...
  105.        //...but first, send a key up event for every currently pressed key
  106.  
  107.       //call QPC only once, since the events technically happen at the same time
  108.       QueryPerformanceCounter((LARGE_INTEGER*)&event.key.timestamp);
  109.  
  110.       using namespace WindowProcEvent;
  111.       KEY_Params params = 0;
  112.       params.currUnpressed = 1;
  113.  
  114.       for(u32 chr=0; chr<256; ++chr){
  115.         //send a KEY_UP only if the state was previously true
  116.         if(opq->keyStates[chr] == true){
  117.           params.scanCode = MapVirtualKeyA(chr, MAPVK_VK_TO_VSC);
  118.           KIT_HANDLE_EVENT(KEY_CHARUPDOWN, false, chr, params, 0);
  119.           if(!AddToEventQueue(event)){ _printf("event queue is full!!!\n"); }
  120.         }
  121.       }
  122.  
  123.       memory::set(opq->keyStates, 0, sizeof(bool)*256); //NOW the states can be reset
  124.       opq->kmod.all = 0; //reset any key modifiers too
  125.  
  126.       opq->winFocus = false;
  127.  
  128.       KIT_HANDLE_EVENT(WIN_UNFOCUSING);
  129.  
  130.     } break;
  131.  
  132.  
  133.     //WINEVENT_WIN_FOCUSED
  134.     case WM_SETFOCUS:
  135.     {
  136.       opq->winFocus = true;
  137.  
  138.       KIT_HANDLE_EVENT(WIN_FOCUSED);
  139.  
  140.     } break;
  141.  
  142.  
  143.     //(no associated event)
  144.     case WM_DESTROY:
  145.     {
  146.       opq->winClosed = true;
  147.  
  148.     } break;
  149.  
  150.  
  151.     //(no associated event)
  152.     case WM_GETMINMAXINFO:
  153.     {
  154.       //enforce minimum window size if canvas does not scale with the window
  155.       if(opq->canvasStretch){
  156.         u32 winStyleCurrent   = GetWindowLongA(winHandle, GWL_STYLE  );
  157.         u32 winStyleExCurrent = GetWindowLongA(winHandle, GWL_EXSTYLE);
  158.         shape::point winSizeAdjusted = CalculateWindowSize(opq->canvas.size.x,
  159.                                                            opq->canvas.size.y,
  160.                                                            winStyleCurrent,
  161.                                                            winStyleExCurrent);
  162.  
  163.         MINMAXINFO* mmi = (MINMAXINFO*)lParam;
  164.         mmi->ptMinTrackSize.x = winSizeAdjusted.x;
  165.         mmi->ptMinTrackSize.y = winSizeAdjusted.y;
  166.       }
  167.  
  168.     } break;
  169.  
  170.  
  171.     //(no associated event)
  172.     case WM_PAINT:
  173.     {
  174.       if(opq->canvas.handle==nullptr) break; //just in case
  175.  
  176.       PAINTSTRUCT paint;
  177.       HDC         winDevCtx; //window device context
  178.       RECT        rectO; //[O]riginal
  179.       shape::rect rectW; //[W]indow
  180.       shape::rect rectF; //[F]rame
  181.  
  182.       //prepare window for painting
  183.       winDevCtx = BeginPaint(winHandle, &paint);
  184.       rectO = paint.rcPaint;
  185.       rectW = ConvertToKitRect(rectO);
  186.  
  187.       //calculate copy region of canvas
  188.       f64 percentageX = (f64)rectW.x/rectW.w; //from 0.0 -> 1.0
  189.       f64 percentageY = (f64)rectW.y/rectW.h; //from 0.0 -> 1.0
  190.       rectF.w = opq->canvas.size.x;
  191.       rectF.h = opq->canvas.size.y;
  192.       rectF.x = (s32)( (f64)rectF.w*percentageX + 0.5 ); //(+0.5 for rounding)
  193.       rectF.y = (s32)( (f64)rectF.y*percentageY + 0.5 );
  194.  
  195.       //copy canvas bitmap to window
  196.       SetStretchBltMode(winDevCtx, opq->winStretchMode);
  197.       StretchBlt(winDevCtx, rectW.x,rectW.y, rectW.w,rectW.h,
  198.                  opq->canvas.devCtx, rectF.x,rectF.y, rectF.w,rectF.h, SRCCOPY);
  199.  
  200.       EndPaint(winHandle, &paint);
  201.  
  202.     } break;
  203.  
  204.  
  205.  
  206.     //keyboard messages (WINEVENT_KEY_<event name>)
  207.  
  208.     //WINEVENT_KEY_CHAR, WINEVENT_KEY_UP, WINEVENT_KEY_DOWN
  209.     case WM_CHAR:
  210.     case WM_SYSKEYUP:
  211.     case WM_SYSKEYDOWN:
  212.     case WM_KEYUP:
  213.     case WM_KEYDOWN:
  214.     case WM_SYSCHAR:
  215.     {
  216. #define printKeyParams() {                                                        \
  217.   _printf("{\n");                                                                 \
  218.   _printf("  charEvent      = %s\n", (charEvent) ? "true" : "false");             \
  219.   _printf("  virtualKeyCode = %c (0x%02X)\n", virtualKeyCode, virtualKeyCode);    \
  220.   _printf("  repeatCount    = %u\n", params.repeatCount);                         \
  221.   _printf("  scanCode       = %c (0x%02X)\n", params.scanCode,params.scanCode);   \
  222.   _printf("  extendedKey    = %s\n", (params.extendedKey) ? "true" : "false");    \
  223.   _printf("  altKeyDown     = %s\n", (params.altKeyDown) ? "true" : "false");     \
  224.   _printf("  prevPressed    = %s\n", (!params.prevUnpressed) ? "true" : "false"); \
  225.   _printf("  currPressed    = %s\n", (!params.currUnpressed) ? "true" : "false"); \
  226.   _printf("}\n"); }
  227.       //^^ i'll remove this stuff once i figure out how to handle key modifiers
  228.  
  229.       using namespace WindowProcEvent;
  230.  
  231.       //marshal relevant stuff to pass to event handler
  232.       bool    charEvent = message==WM_CHAR;
  233.       u8 virtualKeyCode = (u8)wParam;
  234.       KEY_Params params = (u32)lParam;
  235.  
  236.       //set repeat flag
  237.       params.repeatCount = (!params.currUnpressed)        == true &&
  238.                            opq->keyStates[virtualKeyCode] == true;
  239.  
  240.       if(!charEvent) opq->keyStates[virtualKeyCode] = !params.currUnpressed;
  241.  
  242.       //update any relevant key modifiers
  243.       opq->kmod.all = 0; //tbd
  244.  
  245.       KIT_HANDLE_EVENT(KEY_CHARUPDOWN, charEvent, virtualKeyCode,
  246.                                        params,    opq->kmod.all);
  247.  
  248.     } break;
  249.  
  250.  
  251.  
  252.     //mouse messages (WINEVENT_MOUSE_<event name>)
  253.  
  254.     //WINEVENT_MOUSE_MOVE
  255.     case WM_MOUSEMOVE:
  256.     {
  257.       using namespace WindowProcEvent;
  258.  
  259.       //get button states
  260.       MOUSE_ButtonStates buttonStates;
  261.       buttonStates.left   = (wParam&MK_LBUTTON ) != 0;
  262.       buttonStates.middle = (wParam&MK_MBUTTON ) != 0;
  263.       buttonStates.right  = (wParam&MK_RBUTTON ) != 0;
  264.       buttonStates.x1     = (wParam&MK_XBUTTON1) != 0;
  265.       buttonStates.x2     = (wParam&MK_XBUTTON2) != 0;
  266.  
  267.       //get new mouse position
  268.       shape::point mousePositionNew;
  269.       mousePositionNew.x = GET_X_LPARAM(lParam);
  270.       mousePositionNew.y = GET_Y_LPARAM(lParam);
  271.  
  272.       //if this is the first instance of WINEVENT_MOUSE_MOVE,
  273.        //there is no previous mouse position, so the delta should be 0 then
  274.       if(!opq->mouseWasMovedBefore){
  275.         //(handle MOUSE_ENTER events here too, since
  276.          //there is no special message for it)
  277.         KIT_HANDLE_EVENT(MOUSE_ENTER);
  278.         QueryPerformanceCounter((LARGE_INTEGER*)&event.common.timestamp);
  279.         if(!AddToEventQueue(event)){ _printf("event queue is full!!!\n"); }
  280.         opq->mousePosition = mousePositionNew,
  281.         opq->mouseWasMovedBefore = true;
  282.       }
  283.  
  284.       KIT_HANDLE_EVENT(MOUSE_MOVE, buttonStates.value,
  285.                        opq->mousePosition, mousePositionNew);
  286.  
  287.       opq->mousePosition = mousePositionNew; //set current position to new one
  288.  
  289.     } break;
  290.  
  291.  
  292.     //WINEVENT_MOUSE_LEAVE
  293.     case WM_MOUSELEAVE:
  294.     {
  295.       //indicates that the mouse will have yet to be moved inside client area
  296.       opq->mouseWasMovedBefore = false;
  297.  
  298.       KIT_HANDLE_EVENT(MOUSE_LEAVE);
  299.  
  300.     } break;
  301.  
  302.  
  303.     /*WINEVENT_MOUSE_ENTER (is handled inside WM_MOUSEMOVE)
  304.     case WM_<there is no mouse enter message!>:
  305.     {
  306.       KIT_HANDLE_EVENT(MOUSE_ENTER);
  307.  
  308.     } break; */
  309.  
  310.  
  311.     //WINEVENT_MOUSE_UP, WINEVENT_MOUSE_DOWN
  312.      //switchBool  = event.mouse.dblClick
  313.      //switchBool2 = event.mouse.pressed
  314.      //switchFlags = event.mouse.button
  315.     case WM_LBUTTONDBLCLK: switchBool  = true;  goto _notLButtonUp;
  316.     case WM_LBUTTONUP    : switchBool2 = false; _notLButtonUp:
  317.     case WM_LBUTTONDOWN  : switchFlags |= MBUTTON_LEFT; goto _handleMouseClick;
  318.  
  319.     case WM_MBUTTONDBLCLK: switchBool  = true;  goto _notMButtonUp;
  320.     case WM_MBUTTONUP    : switchBool2 = false; _notMButtonUp:
  321.     case WM_MBUTTONDOWN  : switchFlags |= MBUTTON_MIDDLE; goto _handleMouseClick;
  322.  
  323.     case WM_RBUTTONDBLCLK: switchBool  = true;  goto _notRButtonUp;
  324.     case WM_RBUTTONUP    : switchBool2 = false; _notRButtonUp:
  325.     case WM_RBUTTONDOWN  : switchFlags |= MBUTTON_RIGHT; goto _handleMouseClick;
  326.  
  327.     case WM_XBUTTONDBLCLK: switchBool  = true;  goto _notXButtonUp;
  328.     case WM_XBUTTONUP    : switchBool2 = false; _notXButtonUp:
  329.     case WM_XBUTTONDOWN  : if(wParam & MK_XBUTTON1) switchFlags |= MBUTTON_X1;
  330.                            else                     switchFlags |= MBUTTON_X2;
  331.     {
  332.       _handleMouseClick:
  333.  
  334.       shape::point clickPosition;
  335.       clickPosition.x = GET_X_LPARAM(lParam);
  336.       clickPosition.y = GET_Y_LPARAM(lParam);
  337.  
  338.       u8   buttonStates = (u8)switchFlags;
  339.       bool pressed      = switchBool2;
  340.       bool doubleClick  = switchBool;
  341.  
  342.       KIT_HANDLE_EVENT(MOUSE_UPDOWN, clickPosition,
  343.                        buttonStates, pressed, doubleClick);
  344.  
  345.     } break;
  346.  
  347.  
  348.     //WINEVENT_MOUSE_HWHEEL, WINEVENT_MOUSE_VWHEEL
  349.     case WM_MOUSEHWHEEL:
  350.     case WM_MOUSEWHEEL:
  351.     {
  352.       using namespace WindowProcEvent;
  353.  
  354.       bool verticalScroll = message==WM_MOUSEWHEEL;
  355.  
  356.       s16  scrollAmount = (s16)HIWORD(wParam);
  357.  
  358.       MOUSE_ButtonStates buttonStates;
  359.       buttonStates.left   = (wParam&MK_LBUTTON ) != 0;
  360.       buttonStates.middle = (wParam&MK_MBUTTON ) != 0;
  361.       buttonStates.right  = (wParam&MK_RBUTTON ) != 0;
  362.       buttonStates.x1     = (wParam&MK_XBUTTON1) != 0;
  363.       buttonStates.x2     = (wParam&MK_XBUTTON2) != 0;
  364.  
  365.       shape::point scrollMousePosition;
  366.       scrollMousePosition.x = GET_X_LPARAM(lParam);
  367.       scrollMousePosition.y = GET_Y_LPARAM(lParam);
  368.       //the coordinates are relative to the screen, not the window (for some reason)
  369.       ScreenToClient(winHandle, (POINT*)&scrollMousePosition);
  370.  
  371.       KIT_HANDLE_EVENT(MOUSE_HVWHEEL, verticalScroll, scrollAmount,
  372.                        buttonStates.value, scrollMousePosition);
  373.  
  374.     } break;
  375.  
  376.  
  377.  
  378.     default: returnResult = DefWindowProcA(winHandle, message, wParam, lParam);
  379.   }
  380.  
  381.  
  382.  
  383.   if(event.type != WINEVENT_COMMON){
  384.     //idk how expensive QPC is, so i'll only call it if the event is valid
  385.     QueryPerformanceCounter((LARGE_INTEGER*)&event.common.timestamp);
  386.     //i pray AddToEventQueue never fails ever
  387.     if(!AddToEventQueue(event)){ _printf("event queue is full!!!\n"); }
  388.   }
  389.  
  390.  
  391.  
  392.   LeaveCriticalSection(&opq->lock);
  393.   return returnResult;
  394. }
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403. //these are for enabling and disabling what messages are printed
  404.  //simply comment these out to disable them
  405.  
  406. #define KIT_PM_WM_NULL                           //0x0000
  407. #define KIT_PM_WM_CREATE                         //0x0001
  408. #define KIT_PM_WM_DESTROY                        //0x0002
  409. #define KIT_PM_WM_MOVE                           //0x0003
  410. #define KIT_PM_WM_SIZE                           //0x0005
  411. #define KIT_PM_WM_ACTIVATE                       //0x0006
  412. #define KIT_PM_WM_SETFOCUS                       //0x0007
  413. #define KIT_PM_WM_KILLFOCUS                      //0x0008
  414. #define KIT_PM_WM_ENABLE                         //0x000A
  415. #define KIT_PM_WM_SETREDRAW                      //0x000B
  416. #define KIT_PM_WM_SETTEXT                        //0x000C
  417. //#define KIT_PM_WM_GETTEXT                        //0x000D
  418. //#define KIT_PM_WM_GETTEXTLENGTH                  //0x000E
  419. //#define KIT_PM_WM_PAINT                          //0x000F
  420. #define KIT_PM_WM_CLOSE                          //0x0010
  421. #define KIT_PM_WM_QUERYENDSESSION                //0x0011
  422. #define KIT_PM_WM_QUIT                           //0x0012
  423. #define KIT_PM_WM_QUERYOPEN                      //0x0013
  424. #define KIT_PM_WM_ERASEBKGND                     //0x0014
  425. #define KIT_PM_WM_SYSCOLORCHANGE                 //0x0015
  426. #define KIT_PM_WM_ENDSESSION                     //0x0016
  427. #define KIT_PM_WM_SHOWWINDOW                     //0x0018
  428. #define KIT_PM_WM_SETTINGCHANGE                  //0x001A
  429. #define KIT_PM_WM_DEVMODECHANGE                  //0x001B
  430. #define KIT_PM_WM_ACTIVATEAPP                    //0x001C
  431. #define KIT_PM_WM_FONTCHANGE                     //0x001D
  432. #define KIT_PM_WM_TIMECHANGE                     //0x001E
  433. #define KIT_PM_WM_CANCELMODE                     //0x001F
  434. //#define KIT_PM_WM_SETCURSOR                      //0x0020
  435. #define KIT_PM_WM_MOUSEACTIVATE                  //0x0021
  436. #define KIT_PM_WM_CHILDACTIVATE                  //0x0022
  437. #define KIT_PM_WM_QUEUESYNC                      //0x0023
  438. #define KIT_PM_WM_GETMINMAXINFO                  //0x0024
  439. #define KIT_PM_WM_PAINTICON                      //0x0026
  440. #define KIT_PM_WM_ICONERASEBKGND                 //0x0027
  441. #define KIT_PM_WM_NEXTDLGCTL                     //0x0028
  442. #define KIT_PM_WM_SPOOLERSTATUS                  //0x002A
  443. #define KIT_PM_WM_DRAWITEM                       //0x002B
  444. #define KIT_PM_WM_MEASUREITEM                    //0x002C
  445. #define KIT_PM_WM_DELETEITEM                     //0x002D
  446. #define KIT_PM_WM_VKEYTOITEM                     //0x002E
  447. #define KIT_PM_WM_CHARTOITEM                     //0x002F
  448. #define KIT_PM_WM_SETFONT                        //0x0030
  449. #define KIT_PM_WM_GETFONT                        //0x0031
  450. #define KIT_PM_WM_SETHOTKEY                      //0x0032
  451. #define KIT_PM_WM_GETHOTKEY                      //0x0033
  452. #define KIT_PM_WM_QUERYDRAGICON                  //0x0037
  453. #define KIT_PM_WM_COMPAREITEM                    //0x0039
  454. #define KIT_PM_WM_GETOBJECT                      //0x003D
  455. #define KIT_PM_WM_COMPACTING                     //0x0041
  456. #define KIT_PM_WM_COMMNOTIFY                     //0x0044
  457. #define KIT_PM_WM_WINDOWPOSCHANGING              //0x0046
  458. #define KIT_PM_WM_WINDOWPOSCHANGED               //0x0047
  459. #define KIT_PM_WM_POWER                          //0x0048
  460. #define KIT_PM_WM_COPYDATA                       //0x004A
  461. #define KIT_PM_WM_CANCELJOURNAL                  //0x004B
  462. #define KIT_PM_WM_NOTIFY                         //0x004E
  463. #define KIT_PM_WM_INPUTLANGCHANGEREQUEST         //0x0050
  464. #define KIT_PM_WM_INPUTLANGCHANGE                //0x0051
  465. #define KIT_PM_WM_TCARD                          //0x0052
  466. #define KIT_PM_WM_HELP                           //0x0053
  467. #define KIT_PM_WM_USERCHANGED                    //0x0054
  468. #define KIT_PM_WM_NOTIFYFORMAT                   //0x0055
  469. #define KIT_PM_WM_CONTEXTMENU                    //0x007B
  470. #define KIT_PM_WM_STYLECHANGING                  //0x007C
  471. #define KIT_PM_WM_STYLECHANGED                   //0x007D
  472. #define KIT_PM_WM_DISPLAYCHANGE                  //0x007E
  473. #define KIT_PM_WM_GETICON                        //0x007F
  474. #define KIT_PM_WM_SETICON                        //0x0080
  475. #define KIT_PM_WM_NCCREATE                       //0x0081
  476. #define KIT_PM_WM_NCDESTROY                      //0x0082
  477. #define KIT_PM_WM_NCCALCSIZE                     //0x0083
  478. //#define KIT_PM_WM_NCHITTEST                      //0x0084
  479. #define KIT_PM_WM_NCPAINT                        //0x0085
  480. #define KIT_PM_WM_NCACTIVATE                     //0x0086
  481. #define KIT_PM_WM_GETDLGCODE                     //0x0087
  482. #define KIT_PM_WM_SYNCPAINT                      //0x0088
  483.  
  484. //#define KIT_PM_WM_NCMOUSEMOVE                    //0x00A0
  485. #define KIT_PM_WM_NCLBUTTONDOWN                  //0x00A1
  486. #define KIT_PM_WM_NCLBUTTONUP                    //0x00A2
  487. #define KIT_PM_WM_NCLBUTTONDBLCLK                //0x00A3
  488. #define KIT_PM_WM_NCRBUTTONDOWN                  //0x00A4
  489. #define KIT_PM_WM_NCRBUTTONUP                    //0x00A5
  490. #define KIT_PM_WM_NCRBUTTONDBLCLK                //0x00A6
  491. #define KIT_PM_WM_NCMBUTTONDOWN                  //0x00A7
  492. #define KIT_PM_WM_NCMBUTTONUP                    //0x00A8
  493. #define KIT_PM_WM_NCMBUTTONDBLCLK                //0x00A9
  494. #define KIT_PM_WM_NCXBUTTONDOWN                  //0x00AB
  495. #define KIT_PM_WM_NCXBUTTONUP                    //0x00AC
  496. #define KIT_PM_WM_NCXBUTTONDBLCLK                //0x00AD
  497.  
  498. #define KIT_PM_WM_INPUT_DEVICE_CHANGE            //0x00FE
  499. #define KIT_PM_WM_INPUT                          //0x00FF
  500. #define KIT_PM_WM_KEYDOWN                        //0x0100
  501. #define KIT_PM_WM_KEYUP                          //0x0101
  502. #define KIT_PM_WM_CHAR                           //0x0102
  503. #define KIT_PM_WM_DEADCHAR                       //0x0103
  504. #define KIT_PM_WM_SYSKEYDOWN                     //0x0104
  505. #define KIT_PM_WM_SYSKEYUP                       //0x0105
  506. #define KIT_PM_WM_SYSCHAR                        //0x0106
  507. #define KIT_PM_WM_SYSDEADCHAR                    //0x0107
  508. #define KIT_PM_WM_UNICHAR                        //0x0109
  509. #define KIT_PM_WM_IME_STARTCOMPOSITION           //0x010D
  510. #define KIT_PM_WM_IME_ENDCOMPOSITION             //0x010E
  511. #define KIT_PM_WM_IME_COMPOSITION                //0x010F
  512. #define KIT_PM_WM_INITDIALOG                     //0x0110
  513. #define KIT_PM_WM_COMMAND                        //0x0111
  514. #define KIT_PM_WM_SYSCOMMAND                     //0x0112
  515. #define KIT_PM_WM_TIMER                          //0x0113
  516. #define KIT_PM_WM_HSCROLL                        //0x0114
  517. #define KIT_PM_WM_VSCROLL                        //0x0115
  518. #define KIT_PM_WM_INITMENU                       //0x0116
  519. #define KIT_PM_WM_INITMENUPOPUP                  //0x0117
  520. #define KIT_PM_WM_GESTURE                        //0x0119
  521. #define KIT_PM_WM_GESTURENOTIFY                  //0x011A
  522. #define KIT_PM_WM_MENUSELECT                     //0x011F
  523. #define KIT_PM_WM_MENUCHAR                       //0x0120
  524. #define KIT_PM_WM_ENTERIDLE                      //0x0121
  525. #define KIT_PM_WM_MENURBUTTONUP                  //0x0122
  526. #define KIT_PM_WM_MENUDRAG                       //0x0123
  527. #define KIT_PM_WM_MENUGETOBJECT                  //0x0124
  528. #define KIT_PM_WM_UNINITMENUPOPUP                //0x0125
  529. #define KIT_PM_WM_MENUCOMMAND                    //0x0126
  530. #define KIT_PM_WM_CHANGEUISTATE                  //0x0127
  531. #define KIT_PM_WM_UPDATEUISTATE                  //0x0128
  532. #define KIT_PM_WM_QUERYUISTATE                   //0x0129
  533. #define KIT_PM_WM_CTLCOLORMSGBOX                 //0x0132
  534. #define KIT_PM_WM_CTLCOLOREDIT                   //0x0133
  535. #define KIT_PM_WM_CTLCOLORLISTBOX                //0x0134
  536. #define KIT_PM_WM_CTLCOLORBTN                    //0x0135
  537. #define KIT_PM_WM_CTLCOLORDLG                    //0x0136
  538. #define KIT_PM_WM_CTLCOLORSCROLLBAR              //0x0137
  539. #define KIT_PM_WM_CTLCOLORSTATIC                 //0x0138
  540. #define KIT_PM_MN_GETHMENU                       //0x01E1
  541.  
  542. //#define KIT_PM_WM_MOUSEMOVE                      //0x0200
  543. #define KIT_PM_WM_LBUTTONDOWN                    //0x0201
  544. #define KIT_PM_WM_LBUTTONUP                      //0x0202
  545. #define KIT_PM_WM_LBUTTONDBLCLK                  //0x0203
  546. #define KIT_PM_WM_RBUTTONDOWN                    //0x0204
  547. #define KIT_PM_WM_RBUTTONUP                      //0x0205
  548. #define KIT_PM_WM_RBUTTONDBLCLK                  //0x0206
  549. #define KIT_PM_WM_MBUTTONDOWN                    //0x0207
  550. #define KIT_PM_WM_MBUTTONUP                      //0x0208
  551. #define KIT_PM_WM_MBUTTONDBLCLK                  //0x0209
  552. #define KIT_PM_WM_MOUSEWHEEL                     //0x020A
  553. #define KIT_PM_WM_XBUTTONDOWN                    //0x020B
  554. #define KIT_PM_WM_XBUTTONUP                      //0x020C
  555. #define KIT_PM_WM_XBUTTONDBLCLK                  //0x020D
  556.  
  557. #define KIT_PM_WM_PARENTNOTIFY                   //0x0210
  558. #define KIT_PM_WM_ENTERMENULOOP                  //0x0211
  559. #define KIT_PM_WM_EXITMENULOOP                   //0x0212
  560. #define KIT_PM_WM_NEXTMENU                       //0x0213
  561. #define KIT_PM_WM_SIZING                         //0x0214
  562. #define KIT_PM_WM_CAPTURECHANGED                 //0x0215
  563. #define KIT_PM_WM_MOVING                         //0x0216
  564. #define KIT_PM_WM_POWERBROADCAST                 //0x0218
  565. #define KIT_PM_WM_DEVICECHANGE                   //0x0219
  566. #define KIT_PM_WM_MDICREATE                      //0x0220
  567. #define KIT_PM_WM_MDIDESTROY                     //0x0221
  568. #define KIT_PM_WM_MDIACTIVATE                    //0x0222
  569. #define KIT_PM_WM_MDIRESTORE                     //0x0223
  570. #define KIT_PM_WM_MDINEXT                        //0x0224
  571. #define KIT_PM_WM_MDIMAXIMIZE                    //0x0225
  572. #define KIT_PM_WM_MDITILE                        //0x0226
  573. #define KIT_PM_WM_MDICASCADE                     //0x0227
  574. #define KIT_PM_WM_MDIICONARRANGE                 //0x0228
  575. #define KIT_PM_WM_MDIGETACTIVE                   //0x0229
  576. #define KIT_PM_WM_MDISETMENU                     //0x0230
  577. #define KIT_PM_WM_ENTERSIZEMOVE                  //0x0231
  578. #define KIT_PM_WM_EXITSIZEMOVE                   //0x0232
  579. #define KIT_PM_WM_DROPFILES                      //0x0233
  580. #define KIT_PM_WM_MDIREFRESHMENU                 //0x0234
  581. #define KIT_PM_WM_POINTERDEVICECHANGE            //0x0238
  582. #define KIT_PM_WM_POINTERDEVICEINRANGE           //0x0239
  583. #define KIT_PM_WM_POINTERDEVICEOUTOFRANGE        //0x023A
  584. #define KIT_PM_WM_TOUCH                          //0x0240
  585. #define KIT_PM_WM_NCPOINTERUPDATE                //0x0241
  586. #define KIT_PM_WM_NCPOINTERDOWN                  //0x0242
  587. #define KIT_PM_WM_NCPOINTERUP                    //0x0243
  588. #define KIT_PM_WM_POINTERUPDATE                  //0x0245
  589. #define KIT_PM_WM_POINTERDOWN                    //0x0246
  590. #define KIT_PM_WM_POINTERUP                      //0x0247
  591. #define KIT_PM_WM_POINTERENTER                   //0x0249
  592. #define KIT_PM_WM_POINTERLEAVE                   //0x024A
  593. #define KIT_PM_WM_POINTERACTIVATE                //0x024B
  594. #define KIT_PM_WM_POINTERCAPTURECHANGED          //0x024C
  595. #define KIT_PM_WM_TOUCHHITTESTING                //0x024D
  596. #define KIT_PM_WM_POINTERWHEEL                   //0x024E
  597. #define KIT_PM_WM_POINTERHWHEEL                  //0x024F
  598. #define KIT_PM_DM_POINTERHITTEST                 //0x0250
  599. #define KIT_PM_WM_POINTERROUTEDTO                //0x0251
  600. #define KIT_PM_WM_POINTERROUTEDAWAY              //0x0252
  601. #define KIT_PM_WM_POINTERROUTEDRELEASED          //0x0253
  602. #define KIT_PM_WM_IME_SETCONTEXT                 //0x0281
  603. #define KIT_PM_WM_IME_NOTIFY                     //0x0282
  604. #define KIT_PM_WM_IME_CONTROL                    //0x0283
  605. #define KIT_PM_WM_IME_COMPOSITIONFULL            //0x0284
  606. #define KIT_PM_WM_IME_SELECT                     //0x0285
  607. #define KIT_PM_WM_IME_CHAR                       //0x0286
  608. #define KIT_PM_WM_IME_REQUEST                    //0x0288
  609. #define KIT_PM_WM_IME_KEYDOWN                    //0x0290
  610. #define KIT_PM_WM_IME_KEYUP                      //0x0291
  611. #define KIT_PM_WM_MOUSEHOVER                     //0x02A1
  612. #define KIT_PM_WM_MOUSELEAVE                     //0x02A3
  613. #define KIT_PM_WM_NCMOUSEHOVER                   //0x02A0
  614. #define KIT_PM_WM_NCMOUSELEAVE                   //0x02A2
  615. #define KIT_PM_WM_WTSSESSION_CHANGE              //0x02B1
  616. #define KIT_PM_WM_DPICHANGED                     //0x02E0
  617. #define KIT_PM_WM_DPICHANGED_BEFOREPARENT        //0x02E2
  618. #define KIT_PM_WM_DPICHANGED_AFTERPARENT         //0x02E3
  619. #define KIT_PM_WM_GETDPISCALEDSIZE               //0x02E4
  620. #define KIT_PM_WM_CUT                            //0x0300
  621. #define KIT_PM_WM_COPY                           //0x0301
  622. #define KIT_PM_WM_PASTE                          //0x0302
  623. #define KIT_PM_WM_CLEAR                          //0x0303
  624. #define KIT_PM_WM_UNDO                           //0x0304
  625. #define KIT_PM_WM_RENDERFORMAT                   //0x0305
  626. #define KIT_PM_WM_RENDERALLFORMATS               //0x0306
  627. #define KIT_PM_WM_DESTROYCLIPBOARD               //0x0307
  628. #define KIT_PM_WM_DRAWCLIPBOARD                  //0x0308
  629. #define KIT_PM_WM_PAINTCLIPBOARD                 //0x0309
  630. #define KIT_PM_WM_VSCROLLCLIPBOARD               //0x030A
  631. #define KIT_PM_WM_SIZECLIPBOARD                  //0x030B
  632. #define KIT_PM_WM_ASKCBFORMATNAME                //0x030C
  633. #define KIT_PM_WM_CHANGECBCHAIN                  //0x030D
  634. #define KIT_PM_WM_HSCROLLCLIPBOARD               //0x030E
  635. #define KIT_PM_WM_QUERYNEWPALETTE                //0x030F
  636. #define KIT_PM_WM_PALETTEISCHANGING              //0x0310
  637. #define KIT_PM_WM_PALETTECHANGED                 //0x0311
  638. #define KIT_PM_WM_HOTKEY                         //0x0312
  639. #define KIT_PM_WM_PRINT                          //0x0317
  640. #define KIT_PM_WM_PRINTCLIENT                    //0x0318
  641. #define KIT_PM_WM_APPCOMMAND                     //0x0319
  642. #define KIT_PM_WM_THEMECHANGED                   //0x031A
  643. #define KIT_PM_WM_CLIPBOARDUPDATE                //0x031D
  644. #define KIT_PM_WM_DWMCOMPOSITIONCHANGED          //0x031E
  645. #define KIT_PM_WM_DWMNCRENDERINGCHANGED          //0x031F
  646. #define KIT_PM_WM_DWMCOLORIZATIONCOLORCHANGED    //0x0320
  647. #define KIT_PM_WM_DWMWINDOWMAXIMIZEDCHANGE       //0x0321
  648. #define KIT_PM_WM_DWMSENDICONICTHUMBNAIL         //0x0323
  649. #define KIT_PM_WM_DWMSENDICONICLIVEPREVIEWBITMAP //0x0326
  650. #define KIT_PM_WM_GETTITLEBARINFOEX              //0x033F
  651. //#define KIT_PM_WM_UNKNOWN                        //0x????
  652.  
  653.  
  654.  
  655.  
  656. #if defined(_DEBUG) //this function will do nothing otherwise
  657. static void printMessage(HWND hwnd, UINT message,
  658.                          WPARAM wParam, LPARAM lParam)
  659. {
  660.   char* messageName = nullptr;
  661.  
  662.  
  663.   switch(message){
  664. #  ifdef KIT_PM_WM_NULL
  665.   case WM_NULL                          : messageName = "WM_NULL";              break; //0x0000
  666. #  endif
  667.  
  668. #  ifdef KIT_PM_WM_CREATE
  669.   case WM_CREATE                        : messageName = "WM_CREATE";            break; //0x0001
  670. #  endif
  671.  
  672. #  ifdef KIT_PM_WM_DESTROY
  673.   case WM_DESTROY                       : messageName = "WM_DESTROY";           break; //0x0002
  674. #  endif
  675.  
  676. #  ifdef KIT_PM_WM_MOVE
  677.   case WM_MOVE                          : messageName = "WM_MOVE";              break; //0x0003
  678. #  endif
  679.  
  680. #  ifdef KIT_PM_WM_SIZE
  681.   case WM_SIZE                          : messageName = "WM_SIZE";              break; //0x0005
  682. #  endif
  683.  
  684. #  ifdef KIT_PM_WM_ACTIVATE
  685.   case WM_ACTIVATE                      : messageName = "WM_ACTIVATE";          break; //0x0006
  686. #  endif
  687.  
  688. #  ifdef KIT_PM_WM_SETFOCUS
  689.   case WM_SETFOCUS                      : messageName = "WM_SETFOCUS";          break; //0x0007
  690. #  endif
  691.  
  692. #  ifdef KIT_PM_WM_KILLFOCUS
  693.   case WM_KILLFOCUS                     : messageName = "WM_KILLFOCUS";         break; //0x0008
  694. #  endif
  695.  
  696. #  ifdef KIT_PM_WM_ENABLE
  697.   case WM_ENABLE                        : messageName = "WM_ENABLE";            break; //0x000A
  698. #  endif
  699.  
  700. #  ifdef KIT_PM_WM_SETREDRAW
  701.   case WM_SETREDRAW                     : messageName = "WM_SETREDRAW";         break; //0x000B
  702. #  endif
  703.  
  704. #  ifdef KIT_PM_WM_SETTEXT
  705.   case WM_SETTEXT                       : messageName = "WM_SETTEXT";           break; //0x000C
  706. #  endif
  707.  
  708. #  ifdef KIT_PM_WM_GETTEXT
  709.   case WM_GETTEXT                       : messageName = "WM_GETTEXT";           break; //0x000D
  710. #  endif
  711.  
  712. #  ifdef KIT_PM_WM_GETTEXTLENGTH
  713.   case WM_GETTEXTLENGTH                 : messageName = "WM_GETTEXTLENGTH";     break; //0x000E
  714. #  endif
  715.  
  716. #  ifdef KIT_PM_WM_PAINT
  717.   case WM_PAINT                         : messageName = "WM_PAINT";             break; //0x000F
  718. #  endif
  719.  
  720. #  ifdef KIT_PM_WM_CLOSE
  721.   case WM_CLOSE                         : messageName = "WM_CLOSE";             break; //0x0010
  722. #  endif
  723.  
  724. #  ifdef KIT_PM_WM_QUERYENDSESSION
  725.   case WM_QUERYENDSESSION               : messageName = "WM_QUERYENDSESSION";   break; //0x0011
  726. #  endif
  727.  
  728. #  ifdef KIT_PM_WM_QUIT
  729.   case WM_QUIT                          : messageName = "WM_QUIT";              break; //0x0012
  730. #  endif
  731.  
  732. #  ifdef KIT_PM_WM_QUERYOPEN
  733.   case WM_QUERYOPEN                     : messageName = "WM_QUERYOPEN";         break; //0x0013
  734. #  endif
  735.  
  736. #  ifdef KIT_PM_WM_ERASEBKGND
  737.   case WM_ERASEBKGND                    : messageName = "WM_ERASEBKGND";        break; //0x0014
  738. #  endif
  739.  
  740. #  ifdef KIT_PM_WM_SYSCOLORCHANGE
  741.   case WM_SYSCOLORCHANGE                : messageName = "WM_SYSCOLORCHANGE";    break; //0x0015
  742. #  endif
  743.  
  744. #  ifdef KIT_PM_WM_ENDSESSION
  745.   case WM_ENDSESSION                    : messageName = "WM_ENDSESSION";        break; //0x0016
  746. #  endif
  747.  
  748. #  ifdef KIT_PM_WM_SHOWWINDOW
  749.   case WM_SHOWWINDOW                    : messageName = "WM_SHOWWINDOW";        break; //0x0018
  750. #  endif
  751.  
  752. #  ifdef KIT_PM_WM_SETTINGCHANGE
  753.   case WM_SETTINGCHANGE                 : messageName = "WM_SETTINGCHANGE";     break; //0x001A
  754. #  endif
  755.  
  756. #  ifdef KIT_PM_WM_DEVMODECHANGE
  757.   case WM_DEVMODECHANGE                 : messageName = "WM_DEVMODECHANGE";     break; //0x001B
  758. #  endif
  759.  
  760. #  ifdef KIT_PM_WM_ACTIVATEAPP
  761.   case WM_ACTIVATEAPP                   : messageName = "WM_ACTIVATEAPP";       break; //0x001C
  762. #  endif
  763.  
  764. #  ifdef KIT_PM_WM_FONTCHANGE
  765.   case WM_FONTCHANGE                    : messageName = "WM_FONTCHANGE";        break; //0x001D
  766. #  endif
  767.  
  768. #  ifdef KIT_PM_WM_TIMECHANGE
  769.   case WM_TIMECHANGE                    : messageName = "WM_TIMECHANGE";        break; //0x001E
  770. #  endif
  771.  
  772. #  ifdef KIT_PM_WM_CANCELMODE
  773.   case WM_CANCELMODE                    : messageName = "WM_CANCELMODE";        break; //0x001F
  774. #  endif
  775.  
  776. #  ifdef KIT_PM_WM_SETCURSOR
  777.   case WM_SETCURSOR                     : messageName = "WM_SETCURSOR";         break; //0x0020
  778. #  endif
  779.  
  780. #  ifdef KIT_PM_WM_MOUSEACTIVATE
  781.   case WM_MOUSEACTIVATE                 : messageName = "WM_MOUSEACTIVATE";     break; //0x0021
  782. #  endif
  783.  
  784. #  ifdef KIT_PM_WM_CHILDACTIVATE
  785.   case WM_CHILDACTIVATE                 : messageName = "WM_CHILDACTIVATE";     break; //0x0022
  786. #  endif
  787.  
  788. #  ifdef KIT_PM_WM_QUEUESYNC
  789.   case WM_QUEUESYNC                     : messageName = "WM_QUEUESYNC";         break; //0x0023
  790. #  endif
  791.  
  792. #  ifdef KIT_PM_WM_GETMINMAXINFO
  793.   case WM_GETMINMAXINFO                 : messageName = "WM_GETMINMAXINFO";     break; //0x0024
  794. #  endif
  795.  
  796. #  ifdef KIT_PM_WM_PAINTICON
  797.   case WM_PAINTICON                     : messageName = "WM_PAINTICON";         break; //0x0026
  798. #  endif
  799.  
  800. #  ifdef KIT_PM_WM_ICONERASEBKGND
  801.   case WM_ICONERASEBKGND                : messageName = "WM_ICONERASEBKGND";    break; //0x0027
  802. #  endif
  803.  
  804. #  ifdef KIT_PM_WM_NEXTDLGCTL
  805.   case WM_NEXTDLGCTL                    : messageName = "WM_NEXTDLGCTL";        break; //0x0028
  806. #  endif
  807.  
  808. #  ifdef KIT_PM_WM_SPOOLERSTATUS
  809.   case WM_SPOOLERSTATUS                 : messageName = "WM_SPOOLERSTATUS";     break; //0x002A
  810. #  endif
  811.  
  812. #  ifdef KIT_PM_WM_DRAWITEM
  813.   case WM_DRAWITEM                      : messageName = "WM_DRAWITEM";          break; //0x002B
  814. #  endif
  815.  
  816. #  ifdef KIT_PM_WM_MEASUREITEM
  817.   case WM_MEASUREITEM                   : messageName = "WM_MEASUREITEM";       break; //0x002C
  818. #  endif
  819.  
  820. #  ifdef KIT_PM_WM_DELETEITEM
  821.   case WM_DELETEITEM                    : messageName = "WM_DELETEITEM";        break; //0x002D
  822. #  endif
  823.  
  824. #  ifdef KIT_PM_WM_VKEYTOITEM
  825.   case WM_VKEYTOITEM                    : messageName = "WM_VKEYTOITEM";        break; //0x002E
  826. #  endif
  827.  
  828. #  ifdef KIT_PM_WM_CHARTOITEM
  829.   case WM_CHARTOITEM                    : messageName = "WM_CHARTOITEM";        break; //0x002F
  830. #  endif
  831.  
  832. #  ifdef KIT_PM_WM_SETFONT
  833.   case WM_SETFONT                       : messageName = "WM_SETFONT";           break; //0x0030
  834. #  endif
  835.  
  836. #  ifdef KIT_PM_WM_GETFONT
  837.   case WM_GETFONT                       : messageName = "WM_GETFONT";           break; //0x0031
  838. #  endif
  839.  
  840. #  ifdef KIT_PM_WM_SETHOTKEY
  841.   case WM_SETHOTKEY                     : messageName = "WM_SETHOTKEY";         break; //0x0032
  842. #  endif
  843.  
  844. #  ifdef KIT_PM_WM_GETHOTKEY
  845.   case WM_GETHOTKEY                     : messageName = "WM_GETHOTKEY";         break; //0x0033
  846. #  endif
  847.  
  848. #  ifdef KIT_PM_WM_QUERYDRAGICON
  849.   case WM_QUERYDRAGICON                 : messageName = "WM_QUERYDRAGICON";     break; //0x0037
  850. #  endif
  851.  
  852. #  ifdef KIT_PM_WM_COMPAREITEM
  853.   case WM_COMPAREITEM                   : messageName = "WM_COMPAREITEM";       break; //0x0039
  854. #  endif
  855.  
  856.  
  857. #if(WINVER >= 0x0500)
  858. #ifndef _WIN32_WCE
  859. #  ifdef KIT_PM_WM_GETOBJECT
  860.   case WM_GETOBJECT                     : messageName = "WM_GETOBJECT";         break; //0x003D
  861. #  endif
  862. #endif
  863. #endif /* WINVER >= 0x0500 */
  864.  
  865.  
  866. #  ifdef KIT_PM_WM_COMPACTING
  867.   case WM_COMPACTING                    : messageName = "WM_COMPACTING";        break; //0x0041
  868. #  endif
  869.  
  870. #  ifdef KIT_PM_WM_COMMNOTIFY
  871.   case WM_COMMNOTIFY                    : messageName = "WM_COMMNOTIFY";        break; //0x0044
  872. #  endif
  873.  
  874. #  ifdef KIT_PM_WM_WINDOWPOSCHANGING
  875.   case WM_WINDOWPOSCHANGING             : messageName = "WM_WINDOWPOSCHANGING"; break; //0x0046
  876. #  endif
  877.  
  878. #  ifdef KIT_PM_WM_WINDOWPOSCHANGED
  879.   case WM_WINDOWPOSCHANGED              : messageName = "WM_WINDOWPOSCHANGED";  break; //0x0047
  880. #  endif
  881.  
  882. #  ifdef KIT_PM_WM_POWER
  883.   case WM_POWER                         : messageName = "WM_POWER";             break; //0x0048
  884. #  endif
  885.  
  886. #  ifdef KIT_PM_WM_COPYDATA
  887.   case WM_COPYDATA                      : messageName = "WM_COPYDATA";          break; //0x004A
  888. #  endif
  889.  
  890. #  ifdef KIT_PM_WM_CANCELJOURNAL
  891.   case WM_CANCELJOURNAL                 : messageName = "WM_CANCELJOURNAL";     break; //0x004B
  892. #  endif
  893.  
  894.  
  895. #if(WINVER >= 0x0400)
  896. #  ifdef KIT_PM_WM_NOTIFY
  897.   case WM_NOTIFY                        : messageName = "WM_NOTIFY";            break; //0x004E
  898. #  endif
  899.  
  900. #  ifdef KIT_PM_WM_INPUTLANGCHANGEREQUEST
  901.   case WM_INPUTLANGCHANGEREQUEST        : messageName = "WM_INPUTLANGCHANGEREQUEST"; break; //0x0050
  902. #  endif
  903.  
  904. #  ifdef KIT_PM_WM_INPUTLANGCHANGE
  905.   case WM_INPUTLANGCHANGE               : messageName = "WM_INPUTLANGCHANGE";   break; //0x0051
  906. #  endif
  907.  
  908. #  ifdef KIT_PM_WM_TCARD
  909.   case WM_TCARD                         : messageName = "WM_TCARD";             break; //0x0052
  910. #  endif
  911.  
  912. #  ifdef KIT_PM_WM_HELP
  913.   case WM_HELP                          : messageName = "WM_HELP";              break; //0x0053
  914. #  endif
  915.  
  916. #  ifdef KIT_PM_WM_USERCHANGED
  917.   case WM_USERCHANGED                   : messageName = "WM_USERCHANGED";       break; //0x0054
  918. #  endif
  919.  
  920. #  ifdef KIT_PM_WM_NOTIFYFORMAT
  921.   case WM_NOTIFYFORMAT                  : messageName = "WM_NOTIFYFORMAT";      break; //0x0055
  922. #  endif
  923.  
  924. #  ifdef KIT_PM_WM_CONTEXTMENU
  925.   case WM_CONTEXTMENU                   : messageName = "WM_CONTEXTMENU";       break; //0x007B
  926. #  endif
  927.  
  928. #  ifdef KIT_PM_WM_STYLECHANGING
  929.   case WM_STYLECHANGING                 : messageName = "WM_STYLECHANGING";     break; //0x007C
  930. #  endif
  931.  
  932. #  ifdef KIT_PM_WM_STYLECHANGED
  933.   case WM_STYLECHANGED                  : messageName = "WM_STYLECHANGED";      break; //0x007D
  934. #  endif
  935.  
  936. #  ifdef KIT_PM_WM_DISPLAYCHANGE
  937.   case WM_DISPLAYCHANGE                 : messageName = "WM_DISPLAYCHANGE";     break; //0x007E
  938. #  endif
  939.  
  940. #  ifdef KIT_PM_WM_GETICON
  941.   case WM_GETICON                       : messageName = "WM_GETICON";           break; //0x007F
  942. #  endif
  943.  
  944. #  ifdef KIT_PM_WM_SETICON
  945.   case WM_SETICON                       : messageName = "WM_SETICON";           break; //0x0080
  946. #  endif
  947. #endif /* WINVER >= 0x0400 */
  948.  
  949.  
  950. #  ifdef KIT_PM_WM_NCCREATE
  951.   case WM_NCCREATE                      : messageName = "WM_NCCREATE";          break; //0x0081
  952. #  endif
  953.  
  954. #  ifdef KIT_PM_WM_NCDESTROY
  955.   case WM_NCDESTROY                     : messageName = "WM_NCDESTROY";         break; //0x0082
  956. #  endif
  957.  
  958. #  ifdef KIT_PM_WM_NCCALCSIZE
  959.   case WM_NCCALCSIZE                    : messageName = "WM_NCCALCSIZE";        break; //0x0083
  960. #  endif
  961.  
  962. #  ifdef KIT_PM_WM_NCHITTEST
  963.   case WM_NCHITTEST                     : messageName = "WM_NCHITTEST";         break; //0x0084
  964. #  endif
  965.  
  966. #  ifdef KIT_PM_WM_NCPAINT
  967.   case WM_NCPAINT                       : messageName = "WM_NCPAINT";           break; //0x0085
  968. #  endif
  969.  
  970. #  ifdef KIT_PM_WM_NCACTIVATE
  971.   case WM_NCACTIVATE                    : messageName = "WM_NCACTIVATE";        break; //0x0086
  972. #  endif
  973.  
  974. #  ifdef KIT_PM_WM_GETDLGCODE
  975.   case WM_GETDLGCODE                    : messageName = "WM_GETDLGCODE";        break; //0x0087
  976. #  endif
  977.  
  978.  
  979. #ifndef _WIN32_WCE
  980. #  ifdef KIT_PM_WM_SYNCPAINT
  981.   case WM_SYNCPAINT                     : messageName = "WM_SYNCPAINT";         break; //0x0088
  982. #  endif
  983. #endif
  984.  
  985.  
  986. #  ifdef KIT_PM_WM_NCMOUSEMOVE
  987.   case WM_NCMOUSEMOVE                   : messageName = "WM_NCMOUSEMOVE";       break; //0x00A0
  988. #  endif
  989.  
  990. #  ifdef KIT_PM_WM_NCLBUTTONDOWN
  991.   case WM_NCLBUTTONDOWN                 : messageName = "WM_NCLBUTTONDOWN";     break; //0x00A1
  992. #  endif
  993.  
  994. #  ifdef KIT_PM_WM_NCLBUTTONUP
  995.   case WM_NCLBUTTONUP                   : messageName = "WM_NCLBUTTONUP";       break; //0x00A2
  996. #  endif
  997.  
  998. #  ifdef KIT_PM_WM_NCLBUTTONDBLCLK
  999.   case WM_NCLBUTTONDBLCLK               : messageName = "WM_NCLBUTTONDBLCLK";   break; //0x00A3
  1000. #  endif
  1001.  
  1002. #  ifdef KIT_PM_WM_NCRBUTTONDOWN
  1003.   case WM_NCRBUTTONDOWN                 : messageName = "WM_NCRBUTTONDOWN";     break; //0x00A4
  1004. #  endif
  1005.  
  1006. #  ifdef KIT_PM_WM_NCRBUTTONUP
  1007.   case WM_NCRBUTTONUP                   : messageName = "WM_NCRBUTTONUP";       break; //0x00A5
  1008. #  endif
  1009.  
  1010. #  ifdef KIT_PM_WM_NCRBUTTONDBLCLK
  1011.   case WM_NCRBUTTONDBLCLK               : messageName = "WM_NCRBUTTONDBLCLK";   break; //0x00A6
  1012. #  endif
  1013.  
  1014. #  ifdef KIT_PM_WM_NCMBUTTONDOWN
  1015.   case WM_NCMBUTTONDOWN                 : messageName = "WM_NCMBUTTONDOWN";     break; //0x00A7
  1016. #  endif
  1017.  
  1018. #  ifdef KIT_PM_WM_NCMBUTTONUP
  1019.   case WM_NCMBUTTONUP                   : messageName = "WM_NCMBUTTONUP";       break; //0x00A8
  1020. #  endif
  1021.  
  1022. #  ifdef KIT_PM_WM_NCMBUTTONDBLCLK
  1023.   case WM_NCMBUTTONDBLCLK               : messageName = "WM_NCMBUTTONDBLCLK";   break; //0x00A9
  1024. #  endif
  1025.  
  1026.  
  1027. #if(_WIN32_WINNT >= 0x0500)
  1028. #  ifdef KIT_PM_WM_NCXBUTTONDOWN
  1029.   case WM_NCXBUTTONDOWN                 : messageName = "WM_NCXBUTTONDOWN";     break; //0x00AB
  1030. #  endif
  1031.  
  1032. #  ifdef KIT_PM_WM_NCXBUTTONUP
  1033.   case WM_NCXBUTTONUP                   : messageName = "WM_NCXBUTTONUP";       break; //0x00AC
  1034. #  endif
  1035.  
  1036. #  ifdef KIT_PM_WM_NCXBUTTONDBLCLK
  1037.   case WM_NCXBUTTONDBLCLK               : messageName = "WM_NCXBUTTONDBLCLK";   break; //0x00AD
  1038. #  endif
  1039. #endif /* _WIN32_WINNT >= 0x0500 */
  1040.  
  1041.  
  1042. #if(_WIN32_WINNT >= 0x0501)
  1043. #  ifdef KIT_PM_WM_INPUT_DEVICE_CHANGE
  1044.   case WM_INPUT_DEVICE_CHANGE           : messageName = "WM_INPUT_DEVICE_CHANGE"; break; //0x00FE
  1045. #  endif
  1046.  
  1047. #  ifdef KIT_PM_WM_INPUT
  1048.   case WM_INPUT                         : messageName = "WM_INPUT";             break; //0x00FF
  1049. #  endif
  1050. #endif /* _WIN32_WINNT >= 0x0501 */
  1051.  
  1052.  
  1053. #  ifdef KIT_PM_WM_KEYDOWN
  1054.   case WM_KEYDOWN                       : messageName = "WM_KEYDOWN";           break; //0x0100
  1055. #  endif
  1056.  
  1057. #  ifdef KIT_PM_WM_KEYUP
  1058.   case WM_KEYUP                         : messageName = "WM_KEYUP";             break; //0x0101
  1059. #  endif
  1060.  
  1061. #  ifdef KIT_PM_WM_CHAR
  1062.   case WM_CHAR                          : messageName = "WM_CHAR";              break; //0x0102
  1063. #  endif
  1064.  
  1065. #  ifdef KIT_PM_WM_DEADCHAR
  1066.   case WM_DEADCHAR                      : messageName = "WM_DEADCHAR";          break; //0x0103
  1067. #  endif
  1068.  
  1069. #  ifdef KIT_PM_WM_SYSKEYDOWN
  1070.   case WM_SYSKEYDOWN                    : messageName = "WM_SYSKEYDOWN";        break; //0x0104
  1071. #  endif
  1072.  
  1073. #  ifdef KIT_PM_WM_SYSKEYUP
  1074.   case WM_SYSKEYUP                      : messageName = "WM_SYSKEYUP";          break; //0x0105
  1075. #  endif
  1076.  
  1077. #  ifdef KIT_PM_WM_SYSCHAR
  1078.   case WM_SYSCHAR                       : messageName = "WM_SYSCHAR";           break; //0x0106
  1079. #  endif
  1080.  
  1081. #  ifdef KIT_PM_WM_SYSDEADCHAR
  1082.   case WM_SYSDEADCHAR                   : messageName = "WM_SYSDEADCHAR";       break; //0x0107
  1083. #  endif
  1084.  
  1085.  
  1086. #if(_WIN32_WINNT >= 0x0501)
  1087. #  ifdef KIT_PM_WM_UNICHAR
  1088.   case WM_UNICHAR                       : messageName = "WM_UNICHAR";           break; //0x0109
  1089. #  endif
  1090. #endif /* _WIN32_WINNT >= 0x0501 */
  1091.  
  1092.  
  1093. #if(WINVER >= 0x0400)
  1094. #  ifdef KIT_PM_WM_IME_STARTCOMPOSITION
  1095.   case WM_IME_STARTCOMPOSITION          : messageName = "WM_IME_STARTCOMPOSITION"; break; //0x010D
  1096. #  endif
  1097.  
  1098. #  ifdef KIT_PM_WM_IME_ENDCOMPOSITION
  1099.   case WM_IME_ENDCOMPOSITION            : messageName = "WM_IME_ENDCOMPOSITION";   break; //0x010E
  1100. #  endif
  1101.  
  1102. #  ifdef KIT_PM_WM_IME_COMPOSITION
  1103.   case WM_IME_COMPOSITION               : messageName = "WM_IME_COMPOSITION";      break; //0x010F
  1104. #  endif
  1105. #endif /* WINVER >= 0x0400 */
  1106.  
  1107.  
  1108. #  ifdef KIT_PM_WM_INITDIALOG
  1109.   case WM_INITDIALOG                    : messageName = "WM_INITDIALOG";        break; //0x0110
  1110. #  endif
  1111.  
  1112. #  ifdef KIT_PM_WM_COMMAND
  1113.   case WM_COMMAND                       : messageName = "WM_COMMAND";           break; //0x0111
  1114. #  endif
  1115.  
  1116. #  ifdef KIT_PM_WM_SYSCOMMAND
  1117.   case WM_SYSCOMMAND                    : messageName = "WM_SYSCOMMAND";        break; //0x0112
  1118. #  endif
  1119.  
  1120. #  ifdef KIT_PM_WM_TIMER
  1121.   case WM_TIMER                         : messageName = "WM_TIMER";             break; //0x0113
  1122. #  endif
  1123.  
  1124. #  ifdef KIT_PM_WM_HSCROLL
  1125.   case WM_HSCROLL                       : messageName = "WM_HSCROLL";           break; //0x0114
  1126. #  endif
  1127.  
  1128. #  ifdef KIT_PM_WM_VSCROLL
  1129.   case WM_VSCROLL                       : messageName = "WM_VSCROLL";           break; //0x0115
  1130. #  endif
  1131.  
  1132. #  ifdef KIT_PM_WM_INITMENU
  1133.   case WM_INITMENU                      : messageName = "WM_INITMENU";          break; //0x0116
  1134. #  endif
  1135.  
  1136. #  ifdef KIT_PM_WM_INITMENUPOPUP
  1137.   case WM_INITMENUPOPUP                 : messageName = "WM_INITMENUPOPUP";     break; //0x0117
  1138. #  endif
  1139.  
  1140.  
  1141. #if(WINVER >= 0x0601)
  1142. #  ifdef KIT_PM_WM_GESTURE
  1143.   case WM_GESTURE                       : messageName = "WM_GESTURE";           break; //0x0119
  1144. #  endif
  1145.  
  1146. #  ifdef KIT_PM_WM_GESTURENOTIFY
  1147.   case WM_GESTURENOTIFY                 : messageName = "WM_GESTURENOTIFY";     break; //0x011A
  1148. #  endif
  1149. #endif /* WINVER >= 0x0601 */
  1150.  
  1151.  
  1152. #  ifdef KIT_PM_WM_MENUSELECT
  1153.   case WM_MENUSELECT                    : messageName = "WM_MENUSELECT";        break; //0x011F
  1154. #  endif
  1155.  
  1156. #  ifdef KIT_PM_WM_MENUCHAR
  1157.   case WM_MENUCHAR                      : messageName = "WM_MENUCHAR";          break; //0x0120
  1158. #  endif
  1159.  
  1160. #  ifdef KIT_PM_WM_ENTERIDLE
  1161.   case WM_ENTERIDLE                     : messageName = "WM_ENTERIDLE";         break; //0x0121
  1162. #  endif
  1163.  
  1164.  
  1165. /* WHY IS THIS SET UP THIS WAY! */
  1166. #if(WINVER >= 0x0500)
  1167. #ifndef _WIN32_WCE
  1168. #  ifdef KIT_PM_WM_MENURBUTTONUP
  1169.   case WM_MENURBUTTONUP                 : messageName = "WM_MENURBUTTONUP";     break; //0x0122
  1170. #  endif
  1171.  
  1172. #  ifdef KIT_PM_WM_MENUDRAG
  1173.   case WM_MENUDRAG                      : messageName = "WM_MENUDRAG";          break; //0x0123
  1174. #  endif
  1175.  
  1176. #  ifdef KIT_PM_WM_MENUGETOBJECT
  1177.   case WM_MENUGETOBJECT                 : messageName = "WM_MENUGETOBJECT";     break; //0x0124
  1178. #  endif
  1179.  
  1180. #  ifdef KIT_PM_WM_UNINITMENUPOPUP
  1181.   case WM_UNINITMENUPOPUP               : messageName = "WM_UNINITMENUPOPUP";   break; //0x0125
  1182. #  endif
  1183.  
  1184. #  ifdef KIT_PM_WM_MENUCOMMAND
  1185.   case WM_MENUCOMMAND                   : messageName = "WM_MENUCOMMAND";       break; //0x0126
  1186. #  endif
  1187. #ifndef _WIN32_WCE
  1188. #if(_WIN32_WINNT >= 0x0500)
  1189. #  ifdef KIT_PM_WM_CHANGEUISTATE
  1190.   case WM_CHANGEUISTATE                 : messageName = "WM_CHANGEUISTATE";     break; //0x0127
  1191. #  endif
  1192.  
  1193. #  ifdef KIT_PM_WM_UPDATEUISTATE
  1194.   case WM_UPDATEUISTATE                 : messageName = "WM_UPDATEUISTATE";     break; //0x0128
  1195. #  endif
  1196.  
  1197. #  ifdef KIT_PM_WM_QUERYUISTATE
  1198.   case WM_QUERYUISTATE                  : messageName = "WM_QUERYUISTATE";      break; //0x0129
  1199. #  endif
  1200. #endif /* _WIN32_WINNT >= 0x0500 */
  1201. #endif
  1202.  
  1203. #endif
  1204. #endif /* WINVER >= 0x0500 */
  1205. /* WHY IS THIS SET UP THIS WAY! */
  1206.  
  1207.  
  1208.  
  1209. #  ifdef KIT_PM_WM_CTLCOLORMSGBOX
  1210.   case WM_CTLCOLORMSGBOX                : messageName = "WM_CTLCOLORMSGBOX";    break; //0x0132
  1211. #  endif
  1212.  
  1213. #  ifdef KIT_PM_WM_CTLCOLOREDIT
  1214.   case WM_CTLCOLOREDIT                  : messageName = "WM_CTLCOLOREDIT";      break; //0x0133
  1215. #  endif
  1216.  
  1217. #  ifdef KIT_PM_WM_CTLCOLORLISTBOX
  1218.   case WM_CTLCOLORLISTBOX               : messageName = "WM_CTLCOLORLISTBOX";   break; //0x0134
  1219. #  endif
  1220.  
  1221. #  ifdef KIT_PM_WM_CTLCOLORBTN
  1222.   case WM_CTLCOLORBTN                   : messageName = "WM_CTLCOLORBTN";       break; //0x0135
  1223. #  endif
  1224.  
  1225. #  ifdef KIT_PM_WM_CTLCOLORDLG
  1226.   case WM_CTLCOLORDLG                   : messageName = "WM_CTLCOLORDLG";       break; //0x0136
  1227. #  endif
  1228.  
  1229. #  ifdef KIT_PM_WM_CTLCOLORSCROLLBAR
  1230.   case WM_CTLCOLORSCROLLBAR             : messageName = "WM_CTLCOLORSCROLLBAR"; break; //0x0137
  1231. #  endif
  1232.  
  1233. #  ifdef KIT_PM_WM_CTLCOLORSTATIC
  1234.   case WM_CTLCOLORSTATIC                : messageName = "WM_CTLCOLORSTATIC";    break; //0x0138
  1235. #  endif
  1236.  
  1237. #  ifdef KIT_PM_MN_GETHMENU
  1238.   case MN_GETHMENU                      : messageName = "MN_GETHMENU";          break; //0x01E1
  1239. #  endif
  1240.  
  1241. #  ifdef KIT_PM_WM_MOUSEMOVE
  1242.   case WM_MOUSEMOVE                     : messageName = "WM_MOUSEMOVE";         break; //0x0200
  1243. #  endif
  1244.  
  1245. #  ifdef KIT_PM_WM_LBUTTONDOWN
  1246.   case WM_LBUTTONDOWN                   : messageName = "WM_LBUTTONDOWN";       break; //0x0201
  1247. #  endif
  1248.  
  1249. #  ifdef KIT_PM_WM_LBUTTONUP
  1250.   case WM_LBUTTONUP                     : messageName = "WM_LBUTTONUP";         break; //0x0202
  1251. #  endif
  1252.  
  1253. #  ifdef KIT_PM_WM_LBUTTONDBLCLK
  1254.   case WM_LBUTTONDBLCLK                 : messageName = "WM_LBUTTONDBLCLK";     break; //0x0203
  1255. #  endif
  1256.  
  1257. #  ifdef KIT_PM_WM_RBUTTONDOWN
  1258.   case WM_RBUTTONDOWN                   : messageName = "WM_RBUTTONDOWN";       break; //0x0204
  1259. #  endif
  1260.  
  1261. #  ifdef KIT_PM_WM_RBUTTONUP
  1262.   case WM_RBUTTONUP                     : messageName = "WM_RBUTTONUP";         break; //0x0205
  1263. #  endif
  1264.  
  1265. #  ifdef KIT_PM_WM_RBUTTONDBLCLK
  1266.   case WM_RBUTTONDBLCLK                 : messageName = "WM_RBUTTONDBLCLK";     break; //0x0206
  1267. #  endif
  1268.  
  1269. #  ifdef KIT_PM_WM_MBUTTONDOWN
  1270.   case WM_MBUTTONDOWN                   : messageName = "WM_MBUTTONDOWN";       break; //0x0207
  1271. #  endif
  1272.  
  1273. #  ifdef KIT_PM_WM_MBUTTONUP
  1274.   case WM_MBUTTONUP                     : messageName = "WM_MBUTTONUP";         break; //0x0208
  1275. #  endif
  1276.  
  1277. #  ifdef KIT_PM_WM_MBUTTONDBLCLK
  1278.   case WM_MBUTTONDBLCLK                 : messageName = "WM_MBUTTONDBLCLK";     break; //0x0209
  1279. #  endif
  1280.  
  1281.  
  1282. #if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
  1283. #  ifdef KIT_PM_WM_MOUSEWHEEL
  1284.   case WM_MOUSEWHEEL                    : messageName = "WM_MOUSEWHEEL";        break; //0x020A
  1285. #  endif
  1286. #endif
  1287.  
  1288.  
  1289. #if (_WIN32_WINNT >= 0x0500)
  1290. #  ifdef KIT_PM_WM_XBUTTONDOWN
  1291.   case WM_XBUTTONDOWN                   : messageName = "WM_XBUTTONDOWN";       break; //0x020B
  1292. #  endif
  1293.  
  1294. #  ifdef KIT_PM_WM_XBUTTONUP
  1295.   case WM_XBUTTONUP                     : messageName = "WM_XBUTTONUP";         break; //0x020C
  1296. #  endif
  1297.  
  1298. #  ifdef KIT_PM_WM_XBUTTONDBLCLK
  1299.   case WM_XBUTTONDBLCLK                 : messageName = "WM_XBUTTONDBLCLK";     break; //0x020D
  1300. #  endif
  1301. #endif
  1302.  
  1303.  
  1304. #  ifdef KIT_PM_WM_PARENTNOTIFY
  1305.   case WM_PARENTNOTIFY                  : messageName = "WM_PARENTNOTIFY";      break; //0x0210
  1306. #  endif
  1307.  
  1308. #  ifdef KIT_PM_WM_ENTERMENULOOP
  1309.   case WM_ENTERMENULOOP                 : messageName = "WM_ENTERMENULOOP";     break; //0x0211
  1310. #  endif
  1311.  
  1312. #  ifdef KIT_PM_WM_EXITMENULOOP
  1313.   case WM_EXITMENULOOP                  : messageName = "WM_EXITMENULOOP";      break; //0x0212
  1314. #  endif
  1315.  
  1316.  
  1317. #if(WINVER >= 0x0400)
  1318. #  ifdef KIT_PM_WM_NEXTMENU
  1319.   case WM_NEXTMENU                      : messageName = "WM_NEXTMENU";          break; //0x0213
  1320. #  endif
  1321.  
  1322. #  ifdef KIT_PM_WM_SIZING
  1323.   case WM_SIZING                        : messageName = "WM_SIZING";            break; //0x0214
  1324. #  endif
  1325.  
  1326. #  ifdef KIT_PM_WM_CAPTURECHANGED
  1327.   case WM_CAPTURECHANGED                : messageName = "WM_CAPTURECHANGED";    break; //0x0215
  1328. #  endif
  1329.  
  1330. #  ifdef KIT_PM_WM_MOVING
  1331.   case WM_MOVING                        : messageName = "WM_MOVING";            break; //0x0216
  1332. #  endif
  1333.  
  1334. #  ifdef KIT_PM_WM_POWERBROADCAST
  1335.   case WM_POWERBROADCAST                : messageName = "WM_POWERBROADCAST";    break; //0x0218
  1336. #  endif
  1337.  
  1338. #  ifdef KIT_PM_WM_DEVICECHANGE
  1339.   case WM_DEVICECHANGE                  : messageName = "WM_DEVICECHANGE";      break; //0x0219
  1340. #  endif
  1341. #endif /* WINVER >= 0x0400 */
  1342.  
  1343.  
  1344. #  ifdef KIT_PM_WM_MDICREATE
  1345.   case WM_MDICREATE                     : messageName = "WM_MDICREATE";         break; //0x0220
  1346. #  endif
  1347.  
  1348. #  ifdef KIT_PM_WM_MDIDESTROY
  1349.   case WM_MDIDESTROY                    : messageName = "WM_MDIDESTROY";        break; //0x0221
  1350. #  endif
  1351.  
  1352. #  ifdef KIT_PM_WM_MDIACTIVATE
  1353.   case WM_MDIACTIVATE                   : messageName = "WM_MDIACTIVATE";       break; //0x0222
  1354. #  endif
  1355.  
  1356. #  ifdef KIT_PM_WM_MDIRESTORE
  1357.   case WM_MDIRESTORE                    : messageName = "WM_MDIRESTORE";        break; //0x0223
  1358. #  endif
  1359.  
  1360. #  ifdef KIT_PM_WM_MDINEXT
  1361.   case WM_MDINEXT                       : messageName = "WM_MDINEXT";           break; //0x0224
  1362. #  endif
  1363.  
  1364. #  ifdef KIT_PM_WM_MDIMAXIMIZE
  1365.   case WM_MDIMAXIMIZE                   : messageName = "WM_MDIMAXIMIZE";       break; //0x0225
  1366. #  endif
  1367.  
  1368. #  ifdef KIT_PM_WM_MDITILE
  1369.   case WM_MDITILE                       : messageName = "WM_MDITILE";           break; //0x0226
  1370. #  endif
  1371.  
  1372. #  ifdef KIT_PM_WM_MDICASCADE
  1373.   case WM_MDICASCADE                    : messageName = "WM_MDICASCADE";        break; //0x0227
  1374. #  endif
  1375.  
  1376. #  ifdef KIT_PM_WM_MDIICONARRANGE
  1377.   case WM_MDIICONARRANGE                : messageName = "WM_MDIICONARRANGE";    break; //0x0228
  1378. #  endif
  1379.  
  1380. #  ifdef KIT_PM_WM_MDIGETACTIVE
  1381.   case WM_MDIGETACTIVE                  : messageName = "WM_MDIGETACTIVE";      break; //0x0229
  1382. #  endif
  1383.  
  1384. #  ifdef KIT_PM_WM_MDISETMENU
  1385.   case WM_MDISETMENU                    : messageName = "WM_MDISETMENU";        break; //0x0230
  1386. #  endif
  1387.  
  1388. #  ifdef KIT_PM_WM_ENTERSIZEMOVE
  1389.   case WM_ENTERSIZEMOVE                 : messageName = "WM_ENTERSIZEMOVE";     break; //0x0231
  1390. #  endif
  1391.  
  1392. #  ifdef KIT_PM_WM_EXITSIZEMOVE
  1393.   case WM_EXITSIZEMOVE                  : messageName = "WM_EXITSIZEMOVE";      break; //0x0232
  1394. #  endif
  1395.  
  1396. #  ifdef KIT_PM_WM_DROPFILES
  1397.   case WM_DROPFILES                     : messageName = "WM_DROPFILES";         break; //0x0233
  1398. #  endif
  1399.  
  1400. #  ifdef KIT_PM_WM_MDIREFRESHMENU
  1401.   case WM_MDIREFRESHMENU                : messageName = "WM_MDIREFRESHMENU";    break; //0x0234
  1402. #  endif
  1403.  
  1404.  
  1405. #if(WINVER >= 0x0602)
  1406. #  ifdef KIT_PM_WM_POINTERDEVICECHANGE
  1407.   case WM_POINTERDEVICECHANGE           : messageName = "WM_POINTERDEVICECHANGE";     break; //0x0238
  1408. #  endif
  1409.  
  1410. #  ifdef KIT_PM_WM_POINTERDEVICEINRANGE
  1411.   case WM_POINTERDEVICEINRANGE          : messageName = "WM_POINTERDEVICEINRANGE";    break; //0x0239
  1412. #  endif
  1413.  
  1414. #  ifdef KIT_PM_WM_POINTERDEVICEOUTOFRANGE
  1415.   case WM_POINTERDEVICEOUTOFRANGE       : messageName = "WM_POINTERDEVICEOUTOFRANGE"; break; //0x023A
  1416. #  endif
  1417. #endif /* WINVER >= 0x0602 */
  1418.  
  1419.  
  1420. #if(WINVER >= 0x0601)
  1421. #  ifdef KIT_PM_WM_TOUCH
  1422.   case WM_TOUCH                         : messageName = "WM_TOUCH";             break; //0x0240
  1423. #  endif
  1424. #endif /* WINVER >= 0x0601 */
  1425.  
  1426.  
  1427. #if(WINVER >= 0x0602)
  1428. #  ifdef KIT_PM_WM_NCPOINTERUPDATE
  1429.   case WM_NCPOINTERUPDATE               : messageName = "WM_NCPOINTERUPDATE";   break; //0x0241
  1430. #  endif
  1431.  
  1432. #  ifdef KIT_PM_WM_NCPOINTERDOWN
  1433.   case WM_NCPOINTERDOWN                 : messageName = "WM_NCPOINTERDOWN";     break; //0x0242
  1434. #  endif
  1435.  
  1436. #  ifdef KIT_PM_WM_NCPOINTERUP
  1437.   case WM_NCPOINTERUP                   : messageName = "WM_NCPOINTERUP";       break; //0x0243
  1438. #  endif
  1439.  
  1440. #  ifdef KIT_PM_WM_POINTERUPDATE
  1441.   case WM_POINTERUPDATE                 : messageName = "WM_POINTERUPDATE";     break; //0x0245
  1442. #  endif
  1443.  
  1444. #  ifdef KIT_PM_WM_POINTERDOWN
  1445.   case WM_POINTERDOWN                   : messageName = "WM_POINTERDOWN";       break; //0x0246
  1446. #  endif
  1447.  
  1448. #  ifdef KIT_PM_WM_POINTERUP
  1449.   case WM_POINTERUP                     : messageName = "WM_POINTERUP";         break; //0x0247
  1450. #  endif
  1451.  
  1452. #  ifdef KIT_PM_WM_POINTERENTER
  1453.   case WM_POINTERENTER                  : messageName = "WM_POINTERENTER";      break; //0x0249
  1454. #  endif
  1455.  
  1456. #  ifdef KIT_PM_WM_POINTERLEAVE
  1457.   case WM_POINTERLEAVE                  : messageName = "WM_POINTERLEAVE";      break; //0x024A
  1458. #  endif
  1459.  
  1460. #  ifdef KIT_PM_WM_POINTERACTIVATE
  1461.   case WM_POINTERACTIVATE               : messageName = "WM_POINTERACTIVATE";   break; //0x024B
  1462. #  endif
  1463.  
  1464. #  ifdef KIT_PM_WM_POINTERCAPTURECHANGED
  1465.   case WM_POINTERCAPTURECHANGED         : messageName = "WM_POINTERCAPTURECHANGED"; break; //0x024C
  1466. #  endif
  1467.  
  1468. #  ifdef KIT_PM_WM_TOUCHHITTESTING
  1469.   case WM_TOUCHHITTESTING               : messageName = "WM_TOUCHHITTESTING";   break; //0x024D
  1470. #  endif
  1471.  
  1472. #  ifdef KIT_PM_WM_POINTERWHEEL
  1473.   case WM_POINTERWHEEL                  : messageName = "WM_POINTERWHEEL";      break; //0x024E
  1474. #  endif
  1475.  
  1476. #  ifdef KIT_PM_WM_POINTERHWHEEL
  1477.   case WM_POINTERHWHEEL                 : messageName = "WM_POINTERHWHEEL";     break; //0x024F
  1478. #  endif
  1479.  
  1480. #  ifdef KIT_PM_DM_POINTERHITTEST
  1481.   case DM_POINTERHITTEST                : messageName = "DM_POINTERHITTEST";    break; //0x0250
  1482. #  endif
  1483.  
  1484. #  ifdef KIT_PM_WM_POINTERROUTEDTO
  1485.   case WM_POINTERROUTEDTO               : messageName = "WM_POINTERROUTEDTO";   break; //0x0251
  1486. #  endif
  1487.  
  1488. #  ifdef KIT_PM_WM_POINTERROUTEDAWAY
  1489.   case WM_POINTERROUTEDAWAY             : messageName = "WM_POINTERROUTEDAWAY"; break; //0x0252
  1490. #  endif
  1491.  
  1492. #  ifdef KIT_PM_WM_POINTERROUTEDRELEASED2
  1493.   case WM_POINTERROUTEDRELEASED         : messageName = "WM_POINTERROUTEDRELEASED"; break; //0x0253
  1494. #  endif
  1495. #endif /* WINVER >= 0x0602 */
  1496.  
  1497.  
  1498. #if(WINVER >= 0x0400)
  1499. #  ifdef KIT_PM_WM_IME_SETCONTEXT
  1500.   case WM_IME_SETCONTEXT                : messageName = "WM_IME_SETCONTEXT";    break; //0x0281
  1501. #  endif
  1502.  
  1503. #  ifdef KIT_PM_WM_IME_NOTIFY
  1504.   case WM_IME_NOTIFY                    : messageName = "WM_IME_NOTIFY";        break; //0x0282
  1505. #  endif
  1506.  
  1507. #  ifdef KIT_PM_WM_IME_CONTROL
  1508.   case WM_IME_CONTROL                   : messageName = "WM_IME_CONTROL";       break; //0x0283
  1509. #  endif
  1510.  
  1511. #  ifdef KIT_PM_WM_IME_COMPOSITIONFULL
  1512.   case WM_IME_COMPOSITIONFULL           : messageName = "WM_IME_COMPOSITIONFULL"; break; //0x0284
  1513. #  endif
  1514.  
  1515. #  ifdef KIT_PM_WM_IME_SELECT
  1516.   case WM_IME_SELECT                    : messageName = "WM_IME_SELECT";        break; //0x0285
  1517. #  endif
  1518.  
  1519. #  ifdef KIT_PM_WM_IME_CHAR
  1520.   case WM_IME_CHAR                      : messageName = "WM_IME_CHAR";          break; //0x0286
  1521. #  endif
  1522. #endif /* WINVER >= 0x0400 */
  1523.  
  1524.  
  1525. #if(WINVER >= 0x0500)
  1526. #  ifdef KIT_PM_WM_IME_REQUEST
  1527.   case WM_IME_REQUEST                   : messageName = "WM_IME_REQUEST";       break; //0x0288
  1528. #  endif
  1529. #endif /* WINVER >= 0x0500 */
  1530.  
  1531.  
  1532. #if(WINVER >= 0x0400)
  1533. #  ifdef KIT_PM_WM_IME_KEYDOWN
  1534.   case WM_IME_KEYDOWN                   : messageName = "WM_IME_KEYDOWN";       break; //0x0290
  1535. #  endif
  1536.  
  1537. #  ifdef KIT_PM_WM_IME_KEYUP
  1538.   case WM_IME_KEYUP                     : messageName = "WM_IME_KEYUP";         break; //0x0291
  1539. #  endif
  1540. #endif /* WINVER >= 0x0400 */
  1541.  
  1542.  
  1543. #if((_WIN32_WINNT >= 0x0400) || (WINVER >= 0x0500))
  1544. #  ifdef KIT_PM_WM_MOUSEHOVER
  1545.   case WM_MOUSEHOVER                    : messageName = "WM_MOUSEHOVER";        break; //0x02A1
  1546. #  endif
  1547.  
  1548. #  ifdef KIT_PM_WM_MOUSELEAVE
  1549.   case WM_MOUSELEAVE                    : messageName = "WM_MOUSELEAVE";        break; //0x02A3
  1550. #  endif
  1551. #endif
  1552.  
  1553.  
  1554. #if(WINVER >= 0x0500)
  1555. #  ifdef KIT_PM_WM_NCMOUSEHOVER
  1556.   case WM_NCMOUSEHOVER                  : messageName = "WM_NCMOUSEHOVER";      break; //0x02A0
  1557. #  endif
  1558.  
  1559. #  ifdef KIT_PM_WM_NCMOUSELEAVE
  1560.   case WM_NCMOUSELEAVE                  : messageName = "WM_NCMOUSELEAVE";      break; //0x02A2
  1561. #  endif
  1562. #endif /* WINVER >= 0x0500 */
  1563.  
  1564.  
  1565. #if(_WIN32_WINNT >= 0x0501)
  1566. #  ifdef KIT_PM_WM_WTSSESSION_CHANGE
  1567.   case WM_WTSSESSION_CHANGE             : messageName = "WM_WTSSESSION_CHANGE"; break; //0x02B1
  1568. #  endif
  1569. #endif /* _WIN32_WINNT >= 0x0501 */
  1570.  
  1571.  
  1572. #if(WINVER >= 0x0601)
  1573. #  ifdef KIT_PM_WM_DPICHANGED
  1574.   case WM_DPICHANGED                    : messageName = "WM_DPICHANGED";        break; //0x02E0
  1575. #  endif
  1576. #endif /* WINVER >= 0x0601 */
  1577.  
  1578.  
  1579. #if(WINVER >= 0x0605)
  1580. #  ifdef KIT_PM_WM_DPICHANGED_BEFOREPARENT
  1581.   case WM_DPICHANGED_BEFOREPARENT       : messageName = "WM_DPICHANGED_BEFOREPARENT"; break; //0x02E2
  1582. #  endif
  1583.  
  1584. #  ifdef KIT_PM_WM_DPICHANGED_AFTERPARENT
  1585.   case WM_DPICHANGED_AFTERPARENT        : messageName = "WM_DPICHANGED_AFTERPARENT";  break; //0x02E3
  1586. #  endif
  1587.  
  1588. #  ifdef KIT_PM_WM_GETDPISCALEDSIZE
  1589.   case WM_GETDPISCALEDSIZE              : messageName = "WM_GETDPISCALEDSIZE";  break; //0x02E4
  1590. #  endif
  1591. #endif /* WINVER >= 0x0605 */
  1592.  
  1593.  
  1594. #  ifdef KIT_PM_WM_CUT
  1595.   case WM_CUT                           : messageName = "WM_CUT";               break; //0x0300
  1596. #  endif
  1597.  
  1598. #  ifdef KIT_PM_WM_COPY
  1599.   case WM_COPY                          : messageName = "WM_COPY";              break; //0x0301
  1600. #  endif
  1601.  
  1602. #  ifdef KIT_PM_WM_PASTE
  1603.   case WM_PASTE                         : messageName = "WM_PASTE";             break; //0x0302
  1604. #  endif
  1605.  
  1606. #  ifdef KIT_PM_WM_CLEAR
  1607.   case WM_CLEAR                         : messageName = "WM_CLEAR";             break; //0x0303
  1608. #  endif
  1609.  
  1610. #  ifdef KIT_PM_WM_UNDO
  1611.   case WM_UNDO                          : messageName = "WM_UNDO";              break; //0x0304
  1612. #  endif
  1613.  
  1614. #  ifdef KIT_PM_WM_RENDERFORMAT
  1615.   case WM_RENDERFORMAT                  : messageName = "WM_RENDERFORMAT";      break; //0x0305
  1616. #  endif
  1617.  
  1618. #  ifdef KIT_PM_WM_RENDERALLFORMATS
  1619.   case WM_RENDERALLFORMATS              : messageName = "WM_RENDERALLFORMATS";  break; //0x0306
  1620. #  endif
  1621.  
  1622. #  ifdef KIT_PM_WM_DESTROYCLIPBOARD
  1623.   case WM_DESTROYCLIPBOARD              : messageName = "WM_DESTROYCLIPBOARD";  break; //0x0307
  1624. #  endif
  1625.  
  1626. #  ifdef KIT_PM_WM_DRAWCLIPBOARD
  1627.   case WM_DRAWCLIPBOARD                 : messageName = "WM_DRAWCLIPBOARD";     break; //0x0308
  1628. #  endif
  1629.  
  1630. #  ifdef KIT_PM_WM_PAINTCLIPBOARD
  1631.   case WM_PAINTCLIPBOARD                : messageName = "WM_PAINTCLIPBOARD";    break; //0x0309
  1632. #  endif
  1633.  
  1634. #  ifdef KIT_PM_WM_VSCROLLCLIPBOARD
  1635.   case WM_VSCROLLCLIPBOARD              : messageName = "WM_VSCROLLCLIPBOARD";  break; //0x030A
  1636. #  endif
  1637.  
  1638. #  ifdef KIT_PM_WM_SIZECLIPBOARD
  1639.   case WM_SIZECLIPBOARD                 : messageName = "WM_SIZECLIPBOARD";     break; //0x030B
  1640. #  endif
  1641.  
  1642. #  ifdef KIT_PM_WM_ASKCBFORMATNAME
  1643.   case WM_ASKCBFORMATNAME               : messageName = "WM_ASKCBFORMATNAME";   break; //0x030C
  1644. #  endif
  1645.  
  1646. #  ifdef KIT_PM_WM_CHANGECBCHAIN
  1647.   case WM_CHANGECBCHAIN                 : messageName = "WM_CHANGECBCHAIN";     break; //0x030D
  1648. #  endif
  1649.  
  1650. #  ifdef KIT_PM_WM_HSCROLLCLIPBOARD
  1651.   case WM_HSCROLLCLIPBOARD              : messageName = "WM_HSCROLLCLIPBOARD";  break; //0x030E
  1652. #  endif
  1653.  
  1654. #  ifdef KIT_PM_WM_QUERYNEWPALETTE
  1655.   case WM_QUERYNEWPALETTE               : messageName = "WM_QUERYNEWPALETTE";   break; //0x030F
  1656. #  endif
  1657.  
  1658. #  ifdef KIT_PM_WM_PALETTEISCHANGING
  1659.   case WM_PALETTEISCHANGING             : messageName = "WM_PALETTEISCHANGING"; break; //0x0310
  1660. #  endif
  1661.  
  1662. #  ifdef KIT_PM_WM_PALETTECHANGED
  1663.   case WM_PALETTECHANGED                : messageName = "WM_PALETTECHANGED";    break; //0x0311
  1664. #  endif
  1665.  
  1666. #  ifdef KIT_PM_WM_HOTKEY
  1667.   case WM_HOTKEY                        : messageName = "WM_HOTKEY";            break; //0x0312
  1668. #  endif
  1669.  
  1670.  
  1671. #if(WINVER >= 0x0400)
  1672. #  ifdef KIT_PM_WM_PRINT
  1673.   case WM_PRINT                         : messageName = "WM_PRINT";       break; //0x0317
  1674. #  endif
  1675.  
  1676. #  ifdef KIT_PM_WM_PRINTCLIENT
  1677.   case WM_PRINTCLIENT                   : messageName = "WM_PRINTCLIENT"; break; //0x0318
  1678. #  endif
  1679. #endif /* WINVER >= 0x0400 */
  1680.  
  1681.  
  1682. #if(_WIN32_WINNT >= 0x0500)
  1683. #  ifdef KIT_PM_WM_APPCOMMAND
  1684.   case WM_APPCOMMAND                    : messageName = "WM_APPCOMMAND"; break; //0x0319
  1685. #  endif
  1686. #endif /* _WIN32_WINNT >= 0x0500 */
  1687.  
  1688.  
  1689. #if(_WIN32_WINNT >= 0x0501)
  1690. #  ifdef KIT_PM_WM_THEMECHANGED
  1691.   case WM_THEMECHANGED                  : messageName = "WM_THEMECHANGED"; break; //0x031A
  1692. #  endif
  1693. #endif /* _WIN32_WINNT >= 0x0501 */
  1694.  
  1695.  
  1696. #if(_WIN32_WINNT >= 0x0501)
  1697. #  ifdef KIT_PM_WM_CLIPBOARDUPDATE
  1698.   case WM_CLIPBOARDUPDATE               : messageName = "WM_CLIPBOARDUPDATE"; break; //0x031D
  1699. #  endif
  1700. #endif /* _WIN32_WINNT >= 0x0501 */
  1701.  
  1702.  
  1703. #if(_WIN32_WINNT >= 0x0600)
  1704. #  ifdef KIT_PM_WM_DWMCOMPOSITIONCHANGED
  1705.   case WM_DWMCOMPOSITIONCHANGED         : messageName = "WM_DWMCOMPOSITIONCHANGED";       break; //0x031E
  1706. #  endif
  1707.  
  1708. #  ifdef KIT_PM_WM_DWMNCRENDERINGCHANGED
  1709.   case WM_DWMNCRENDERINGCHANGED         : messageName = "WM_DWMNCRENDERINGCHANGED";       break; //0x031F
  1710. #  endif
  1711.  
  1712. #  ifdef KIT_PM_WM_DWMCOLORIZATIONCOLORCHANGED
  1713.   case WM_DWMCOLORIZATIONCOLORCHANGED   : messageName = "WM_DWMCOLORIZATIONCOLORCHANGED"; break; //0x0320
  1714. #  endif
  1715.  
  1716. #  ifdef KIT_PM_WM_DWMWINDOWMAXIMIZEDCHANGE
  1717.   case WM_DWMWINDOWMAXIMIZEDCHANGE      : messageName = "WM_DWMWINDOWMAXIMIZEDCHANGE";    break; //0x0321
  1718. #  endif
  1719. #endif /* _WIN32_WINNT >= 0x0600 */
  1720.  
  1721.  
  1722. #if(_WIN32_WINNT >= 0x0601)
  1723. #  ifdef KIT_PM_WM_DWMSENDICONICTHUMBNAIL
  1724.   case WM_DWMSENDICONICTHUMBNAIL        : messageName = "WM_DWMSENDICONICTHUMBNAIL";         break; //0x0323
  1725. #  endif
  1726.  
  1727. #  ifdef KIT_PM_WM_DWMSENDICONICLIVEPREVIEWBITMAP
  1728.   case WM_DWMSENDICONICLIVEPREVIEWBITMAP: messageName = "WM_DWMSENDICONICLIVEPREVIEWBITMAP"; break; //0x0326
  1729. #  endif
  1730. #endif /* _WIN32_WINNT >= 0x0601 */
  1731.  
  1732.  
  1733. #if(WINVER >= 0x0600)
  1734. #  ifdef KIT_PM_WM_GETTITLEBARINFOEX
  1735.   case WM_GETTITLEBARINFOEX             : messageName = "WM_GETTITLEBARINFOEX"; break; //0x033F
  1736. #  endif
  1737. #endif /* WINVER >= 0x0600 */
  1738.  
  1739.  
  1740.   default:;
  1741. #  ifdef KIT_PM_WM_UNKNOWN
  1742.   messageName = "(unknown)";
  1743. #  endif
  1744.   }
  1745.  
  1746.  
  1747.  
  1748.   if(messageName != nullptr){
  1749.     printf("hwnd=%p, wParam=0x%08X, lParam=%p, msg={ 0x%08X \"%s\" }\n",
  1750.            hwnd, (u32)wParam, (void*)lParam, message, messageName);
  1751.   }
  1752. }
  1753. #endif /* _DEBUG */
  1754.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement