Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Window Message To Human Readable Decoder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Window Message To Human Readable Decoder

    Annoyingly useful debugging function to see what window messages are being passed to a WinProc in what order. Usage is simple, just have something like:
    Code:
    Work = HEX$(hWnd, 8) &" "& WinMessage(wMsg) _
        &" W:"& HEX$(wParam, 8) &" L:"& HEX$(lParam, 8)
    #DEBUG PRINT Work
    In the WinProc you're interested in examining, and you get:
    Code:
    000A06A4 WM_NCCREATE W:00000000 L:0012FB78
    000A06A4 WM_NCCALCSIZE W:00000000 L:0012FBB4
    000A06A4 WM_CREATE W:00000000 L:0012FB70
    000A06A4 WM_SIZE W:00000000 L:00200020
    000A06A4 WM_MOVE W:00000000 L:000E0007
    000A06A4 WM_SHOWWINDOW W:00000001 L:00000000
    000A06A4 WM_SETFONT W:AD0A0779 L:00000001
    000A06A4 WM_WINDOWPOSCHANGING W:00000000 L:0012FA98
    000A06A4 WM_CHILDACTIVATE W:00000000 L:00000000
    000A06A4 WM_WINDOWPOSCHANGED W:00000000 L:0012FA98
    000A06A4 WM_MOVE W:00000000 L:000100D7
    000A06A4 WM_WINDOWPOSCHANGING W:00000000 L:0012FA98
    000A06A4 WM_NCCALCSIZE W:00000001 L:0012FA6C
    000A06A4 WM_CHILDACTIVATE W:00000000 L:00000000
    000A06A4 WM_WINDOWPOSCHANGED W:00000000 L:0012FA98
    000A06A4 WM_SIZE W:00000000 L:011501AA
    000A06A4 WM_NCPAINT W:00000001 L:00000000
    000A06A4 WM_ERASEBKGND W:44010B25 L:00000000
    000A06A4 WM_PAINT W:00000000 L:00000000
    Reached Destroy
    000A06A4 WM_DESTROY W:00000000 L:00000000
    000A06A4 WM_NCDESTROY W:00000000 L:00000000
    In the debug window, or TRACE LOG if using it that way.
    Code:
    FUNCTION WinMessage(What AS LONG) AS STRING
    SELECT CASE What
      CASE 6: WinMessage = "WM_ACTIVATE"
      CASE 28: WinMessage = "WM_ACTIVATEAPP"
      CASE 864: WinMessage = "WM_AFXFIRST"
      CASE 895: WinMessage = "WM_AFXLAST"
      CASE 793: WinMessage = "WM_APPCOMMAND"
      CASE 780: WinMessage = "WM_ASKCBFORMATNAME"
      CASE 75: WinMessage = "WM_CANCELJOURNAL"
      CASE 31: WinMessage = "WM_CANCELMODE"
      CASE 533: WinMessage = "WM_CAPTURECHANGED"
      CASE 781: WinMessage = "WM_CHANGECBCHAIN"
      CASE 295: WinMessage = "WM_CHANGEUISTATE"
      CASE 258: WinMessage = "WM_CHAR"
      CASE 47: WinMessage = "WM_CHARTOITEM"
      CASE 34: WinMessage = "WM_CHILDACTIVATE"
      CASE 771: WinMessage = "WM_CLEAR"
      CASE 16: WinMessage = "WM_CLOSE"
      CASE 273: WinMessage = "WM_COMMAND"
      CASE 68: WinMessage = "WM_COMMNOTIFY"
      CASE 65: WinMessage = "WM_COMPACTING"
      CASE 57: WinMessage = "WM_COMPAREITEM"
      CASE 123: WinMessage = "WM_CONTEXTMENU"
      CASE 769: WinMessage = "WM_COPY"
      CASE 74: WinMessage = "WM_COPYDATA"
      CASE 1: WinMessage = "WM_CREATE"
      CASE 309: WinMessage = "WM_CTLCOLORBTN"
      CASE 310: WinMessage = "WM_CTLCOLORDLG"
      CASE 307: WinMessage = "WM_CTLCOLOREDIT"
      CASE 308: WinMessage = "WM_CTLCOLORLISTBOX"
      CASE 306: WinMessage = "WM_CTLCOLORMSGBOX"
      CASE 311: WinMessage = "WM_CTLCOLORSCROLLBAR"
      CASE 312: WinMessage = "WM_CTLCOLORSTATIC"
      CASE 768: WinMessage = "WM_CUT"
      CASE 259: WinMessage = "WM_DEADCHAR"
      CASE 45: WinMessage = "WM_DELETEITEM"
      CASE 2: WinMessage = "WM_DESTROY"
      CASE 775: WinMessage = "WM_DESTROYCLIPBOARD"
      CASE 537: WinMessage = "WM_DEVICECHANGE"
      CASE 27: WinMessage = "WM_DEVMODECHANGE"
      CASE 126: WinMessage = "WM_DISPLAYCHANGE"
      CASE 776: WinMessage = "WM_DRAWCLIPBOARD"
      CASE 43: WinMessage = "WM_DRAWITEM"
      CASE 563: WinMessage = "WM_DROPFILES"
      CASE 10: WinMessage = "WM_ENABLE"
      CASE 22: WinMessage = "WM_ENDSESSION"
      CASE 289: WinMessage = "WM_ENTERIDLE"
      CASE 529: WinMessage = "WM_ENTERMENULOOP"
      CASE 561: WinMessage = "WM_ENTERSIZEMOVE"
      CASE 20: WinMessage = "WM_ERASEBKGND"
      CASE 530: WinMessage = "WM_EXITMENULOOP"
      CASE 562: WinMessage = "WM_EXITSIZEMOVE"
      CASE 29: WinMessage = "WM_FONTCHANGE"
      CASE 135: WinMessage = "WM_GETDLGCODE"
      CASE 49: WinMessage = "WM_GETFONT"
      CASE 51: WinMessage = "WM_GETHOTKEY"
      CASE 127: WinMessage = "WM_GETICON"
      CASE 36: WinMessage = "WM_GETMINMAXINFO"
      CASE 61: WinMessage = "WM_GETOBJECT"
      CASE 13: WinMessage = "WM_GETTEXT"
      CASE 14: WinMessage = "WM_GETTEXTLENGTH"
      CASE 856: WinMessage = "WM_HANDHELDFIRST"
      CASE 863: WinMessage = "WM_HANDHELDLAST"
      CASE 83: WinMessage = "WM_HELP"
      CASE 786: WinMessage = "WM_HOTKEY"
      CASE 276: WinMessage = "WM_HSCROLL"
      CASE 782: WinMessage = "WM_HSCROLLCLIPBOARD"
      CASE 39: WinMessage = "WM_ICONERASEBKGND"
      CASE 272: WinMessage = "WM_INITDIALOG"
      CASE 278: WinMessage = "WM_INITMENU"
      CASE 279: WinMessage = "WM_INITMENUPOPUP"
      CASE 255: WinMessage = "WM_INPUT"
      CASE 81: WinMessage = "WM_INPUTLANGCHANGE"
      CASE 80: WinMessage = "WM_INPUTLANGCHANGEREQUEST"
      CASE 81: WinMessage = "WM_INPUTLANGUAGECHANGE"
      CASE 80: WinMessage = "WM_INPUTLANGUAGECHANGEREQUEST"
      CASE 256: WinMessage = "WM_KEYDOWN"
      CASE 256: WinMessage = "WM_KEYFIRST"
      CASE 265: WinMessage = "WM_KEYLAST"
      CASE 257: WinMessage = "WM_KEYUP"
      CASE 8: WinMessage = "WM_KILLFOCUS"
      CASE 515: WinMessage = "WM_LBUTTONDBLCLK"
      CASE 513: WinMessage = "WM_LBUTTONDOWN"
      CASE 514: WinMessage = "WM_LBUTTONUP"
      CASE 521: WinMessage = "WM_MBUTTONDBLCLK"
      CASE 519: WinMessage = "WM_MBUTTONDOWN"
      CASE 520: WinMessage = "WM_MBUTTONUP"
      CASE 546: WinMessage = "WM_MDIACTIVATE"
      CASE 551: WinMessage = "WM_MDICASCADE"
      CASE 544: WinMessage = "WM_MDICREATE"
      CASE 545: WinMessage = "WM_MDIDESTROY"
      CASE 553: WinMessage = "WM_MDIGETACTIVE"
      CASE 552: WinMessage = "WM_MDIICONARRANGE"
      CASE 549: WinMessage = "WM_MDIMAXIMIZE"
      CASE 548: WinMessage = "WM_MDINEXT"
      CASE 564: WinMessage = "WM_MDIREFRESHMENU"
      CASE 547: WinMessage = "WM_MDIRESTORE"
      CASE 560: WinMessage = "WM_MDISETMENU"
      CASE 550: WinMessage = "WM_MDITILE"
      CASE 44: WinMessage = "WM_MEASUREITEM"
      CASE 288: WinMessage = "WM_MENUCHAR"
      CASE 294: WinMessage = "WM_MENUCOMMAND"
      CASE 291: WinMessage = "WM_MENUDRAG"
      CASE 292: WinMessage = "WM_MENUGETOBJECT"
      CASE 290: WinMessage = "WM_MENURBUTTONUP"
      CASE 287: WinMessage = "WM_MENUSELECT"
      CASE 33: WinMessage = "WM_MOUSEACTIVATE"
      CASE 512: WinMessage = "WM_MOUSEFIRST"
      CASE 673: WinMessage = "WM_MOUSEHOVER"
      CASE 525: WinMessage = "WM_MOUSELAST"
      CASE 675: WinMessage = "WM_MOUSELEAVE"
      CASE 512: WinMessage = "WM_MOUSEMOVE"
      CASE 522: WinMessage = "WM_MOUSEWHEEL"
      CASE 3: WinMessage = "WM_MOVE"
      CASE 534: WinMessage = "WM_MOVING"
      CASE 134: WinMessage = "WM_NCACTIVATE"
      CASE 131: WinMessage = "WM_NCCALCSIZE"
      CASE 129: WinMessage = "WM_NCCREATE"
      CASE 130: WinMessage = "WM_NCDESTROY"
      CASE 132: WinMessage = "WM_NCHITTEST"
      CASE 163: WinMessage = "WM_NCLBUTTONDBLCLK"
      CASE 161: WinMessage = "WM_NCLBUTTONDOWN"
      CASE 162: WinMessage = "WM_NCLBUTTONUP"
      CASE 169: WinMessage = "WM_NCMBUTTONDBLCLK"
      CASE 167: WinMessage = "WM_NCMBUTTONDOWN"
      CASE 168: WinMessage = "WM_NCMBUTTONUP"
      CASE 160: WinMessage = "WM_NCMOUSEMOVE"
      CASE 133: WinMessage = "WM_NCPAINT"
      CASE 166: WinMessage = "WM_NCRBUTTONDBLCLK"
      CASE 164: WinMessage = "WM_NCRBUTTONDOWN"
      CASE 165: WinMessage = "WM_NCRBUTTONUP"
      CASE 173: WinMessage = "WM_NCXBUTTONDBLCLK"
      CASE 171: WinMessage = "WM_NCXBUTTONDOWN"
      CASE 172: WinMessage = "WM_NCXBUTTONUP"
      CASE 40: WinMessage = "WM_NEXTDLGCTL"
      CASE 78: WinMessage = "WM_NOTIFY"
      CASE 85: WinMessage = "WM_NOTIFYFORMAT"
      CASE 0: WinMessage = "WM_NULL"
      CASE 66: WinMessage = "WM_OTHERWINDOWCREATED"
      CASE 67: WinMessage = "WM_OTHERWINDOWDESTROYED"
      CASE 15: WinMessage = "WM_PAINT"
      CASE 777: WinMessage = "WM_PAINTCLIPBOARD"
      CASE 38: WinMessage = "WM_PAINTICON"
      CASE 785: WinMessage = "WM_PALETTECHANGED"
      CASE 784: WinMessage = "WM_PALETTEISCHANGING"
      CASE 528: WinMessage = "WM_PARENTNOTIFY"
      CASE 770: WinMessage = "WM_PASTE"
      CASE 896: WinMessage = "WM_PENWINFIRST"
      CASE 911: WinMessage = "WM_PENWINLAST"
      CASE 72: WinMessage = "WM_POWER"
      CASE 536: WinMessage = "WM_POWERBROADCAST"
      CASE 791: WinMessage = "WM_PRINT"
      CASE 792: WinMessage = "WM_PRINTCLIENT"
      CASE 55: WinMessage = "WM_QUERYDRAGICON"
      CASE 17: WinMessage = "WM_QUERYENDSESSION"
      CASE 783: WinMessage = "WM_QUERYNEWPALETTE"
      CASE 19: WinMessage = "WM_QUERYOPEN"
      CASE 297: WinMessage = "WM_QUERYUISTATE"
      CASE 35: WinMessage = "WM_QUEUESYNC"
      CASE 18: WinMessage = "WM_QUIT"
      CASE 518: WinMessage = "WM_RBUTTONDBLCLK"
      CASE 516: WinMessage = "WM_RBUTTONDOWN"
      CASE 517: WinMessage = "WM_RBUTTONUP"
      CASE 774: WinMessage = "WM_RENDERALLFORMATS"
      CASE 773: WinMessage = "WM_RENDERFORMAT"
      CASE 32: WinMessage = "WM_SETCURSOR"
      CASE 7: WinMessage = "WM_SETFOCUS"
      CASE 48: WinMessage = "WM_SETFONT"
      CASE 50: WinMessage = "WM_SETHOTKEY"
      CASE 128: WinMessage = "WM_SETICON"
      CASE 11: WinMessage = "WM_SETREDRAW"
      CASE 12: WinMessage = "WM_SETTEXT"
      CASE 26: WinMessage = "WM_SETTINGCHANGE"
      CASE 24: WinMessage = "WM_SHOWWINDOW"
      CASE 5: WinMessage = "WM_SIZE"
      CASE 779: WinMessage = "WM_SIZECLIPBOARD"
      CASE 532: WinMessage = "WM_SIZING"
      CASE 42: WinMessage = "WM_SPOOLERSTATUS"
      CASE 125: WinMessage = "WM_STYLECHANGED"
      CASE 124: WinMessage = "WM_STYLECHANGING"
      CASE 136: WinMessage = "WM_SYNCPAINT"
      CASE 262: WinMessage = "WM_SYSCHAR"
      CASE 21: WinMessage = "WM_SYSCOLORCHANGE"
      CASE 274: WinMessage = "WM_SYSCOMMAND"
      CASE 263: WinMessage = "WM_SYSDEADCHAR"
      CASE 260: WinMessage = "WM_SYSKEYDOWN"
      CASE 261: WinMessage = "WM_SYSKEYUP"
      CASE 704: WinMessage = "WM_TABLET_FIRST"
      CASE 735: WinMessage = "WM_TABLET_LAST"
      CASE 82: WinMessage = "WM_TCARD"
      CASE 794: WinMessage = "WM_THEMECHANGED"
      CASE 30: WinMessage = "WM_TIMECHANGE"
      CASE 275: WinMessage = "WM_TIMER"
      CASE 772: WinMessage = "WM_UNDO"
      CASE 265: WinMessage = "WM_UNICHAR"
      CASE 293: WinMessage = "WM_UNINITMENUPOPUP"
      CASE 296: WinMessage = "WM_UPDATEUISTATE"
      CASE 84: WinMessage = "WM_USERCHANGED"
      CASE 46: WinMessage = "WM_VKEYTOITEM"
      CASE 277: WinMessage = "WM_VSCROLL"
      CASE 778: WinMessage = "WM_VSCROLLCLIPBOARD"
      CASE 71: WinMessage = "WM_WINDOWPOSCHANGED"
      CASE 70: WinMessage = "WM_WINDOWPOSCHANGING"
      CASE 26: WinMessage = "WM_WININICHANGE"
      CASE 689: WinMessage = "WM_WTSSESSION_CHANGE"
      CASE 525: WinMessage = "WM_XBUTTONDBLCLK"
      CASE 523: WinMessage = "WM_XBUTTONDOWN"
      CASE 524: WinMessage = "WM_XBUTTONUP"
      CASE ELSE: WinMessage = "Unknown:" & HEX$(What, 8)
    END SELECT
    END FUNCTION
    Just remember to comment out messages you're not interested in seeing, or being flooded by, say like MouseMove messages, ...

    (Possible mod, replace the numbers with the PB Constants, never bothered doing that myself.)
    Furcadia, an interesting online MMORPG in which you can create and program your own content.

  • #2
    You know, you did not have to type all that, because it's already been done for you.

    See the WinMsg program in the samples folder provided w/compiler.

    And that comes with a bonus: you can learn how to create and use a DLL and a STRINGTABLE resource while you are at it.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Actually, I didn't actually type any of it, except in the template used by a excel macro to scan win32api for wm_ message's, ...

      Or was it a windows.h, I forget.
      Furcadia, an interesting online MMORPG in which you can create and program your own content.

      Comment

      Working...
      X