-- Win message constants (WM namespace only)
-- Author: Valentin Schmidt
-- Version: 0.1
-- After loading script via require, table 'winmsg' has both numeric and string
-- indexes that allow to both convert message numbers to message names and
-- message names to message numbers.
-- In addition, winmsg.all contains a complete table of all message numbers,
-- which can be useful for analysing the message transfer for a specifc window,
-- by passing it as second argument to function winapiex.msgListen()
local msg = {}
msg[522] = "WM_MOUSEWHEEL"
msg[6] = "WM_ACTIVATE"
msg[28] = "WM_ACTIVATEAPP"
msg[780] = "WM_ASKCBFORMATNAME"
msg[75] = "WM_CANCELJOURNAL"
msg[31] = "WM_CANCELMODE"
msg[533] = "WM_CAPTURECHANGED"
msg[781] = "WM_CHANGECBCHAIN"
msg[258] = "WM_CHAR"
msg[47] = "WM_CHARTOITEM"
msg[34] = "WM_CHILDACTIVATE"
msg[1025] = "WM_CHOOSEFONT_GETLOGFONT"
msg[1126] = "WM_CHOOSEFONT_SETFLAGS"
msg[1125] = "WM_CHOOSEFONT_SETLOGFONT"
msg[771] = "WM_CLEAR"
msg[16] = "WM_CLOSE"
msg[273] = "WM_COMMAND"
msg[67] = "WM_COMPACTING"
msg[57] = "WM_COMPAREITEM"
msg[123] = "WM_CONTEXTMENU"
msg[769] = "WM_COPY"
msg[74] = "WM_COPYDATA"
msg[1] = "WM_CREATE"
msg[309] = "WM_CTLCOLORBTN"
msg[310] = "WM_CTLCOLORDLG"
msg[307] = "WM_CTLCOLOREDIT"
msg[308] = "WM_CTLCOLORLISTBOX"
msg[306] = "WM_CTLCOLORmsgBOX"
msg[311] = "WM_CTLCOLORSCROLLBAR"
msg[312] = "WM_CTLCOLORSTATIC"
msg[768] = "WM_CUT"
msg[926] = "WM_DDE_ACK"
msg[924] = "WM_DDE_ADVISE"
msg[927] = "WM_DDE_DATA"
msg[930] = "WM_DDE_EXECUTE"
msg[922] = "WM_DDE_FIRST"
msg[922] = "WM_DDE_INITIATE"
msg[930] = "WM_DDE_LAST"
msg[929] = "WM_DDE_POKE"
msg[928] = "WM_DDE_REQUEST"
msg[923] = "WM_DDE_TERMINATE"
msg[925] = "WM_DDE_UNADVISE"
msg[259] = "WM_DEADCHAR"
msg[45] = "WM_DELETEITEM"
msg[2] = "WM_DESTROY"
msg[775] = "WM_DESTROYCLIPBOARD"
msg[537] = "WM_DEVICECHANGE"
msg[27] = "WM_DEVMODECHANGE"
msg[126] = "WM_DISPLAYCHANGE"
msg[776] = "WM_DRAWCLIPBOARD"
msg[43] = "WM_DRAWITEM"
msg[563] = "WM_DROPFILES"
msg[10] = "WM_ENABLE"
msg[22] = "WM_ENDSESSION"
msg[289] = "WM_ENTERIDLE"
msg[529] = "WM_ENTERMENULOOP"
msg[561] = "WM_ENTERSIZEMOVE"
msg[20] = "WM_ERASEBKGND"
msg[530] = "WM_EXITMENULOOP"
msg[562] = "WM_EXITSIZEMOVE"
msg[29] = "WM_FONTCHANGE"
msg[135] = "WM_GETDLGCODE"
msg[49] = "WM_GETFONT"
msg[51] = "WM_GETHOTKEY"
msg[127] = "WM_GETICON"
msg[36] = "WM_GETMINMAXINFO"
msg[13] = "WM_GETTEXT"
msg[14] = "WM_GETTEXTLENGTH"
msg[83] = "WM_HELP"
msg[786] = "WM_HOTKEY"
msg[276] = "WM_HSCROLL"
msg[782] = "WM_HSCROLLCLIPBOARD"
msg[39] = "WM_ICONERASEBKGND"
msg[646] = "WM_IME_CHAR"
msg[271] = "WM_IME_COMPOSITION"
msg[644] = "WM_IME_COMPOSITIONFULL"
msg[643] = "WM_IME_CONTROL"
msg[270] = "WM_IME_ENDCOMPOSITION"
msg[656] = "WM_IME_KEYDOWN"
msg[657] = "WM_IME_KEYUP"
msg[642] = "WM_IME_NOTIFY"
msg[645] = "WM_IME_SELECT"
msg[641] = "WM_IME_SETCONTEXT"
msg[269] = "WM_IME_STARTCOMPOSITION"
msg[272] = "WM_INITDIALOG"
msg[278] = "WM_INITMENU"
msg[279] = "WM_INITMENUPOPUP"
msg[81] = "WM_INPUTLANGCHANGE"
msg[80] = "WM_INPUTLANGCHANGEREQUEST"
msg[256] = "WM_KEYDOWN"
msg[256] = "WM_KEYFIRST"
msg[264] = "WM_KEYLAST"
msg[257] = "WM_KEYUP"
msg[8] = "WM_KILLFOCUS"
msg[515] = "WM_LBUTTONDBLCLK"
msg[513] = "WM_LBUTTONDOWN"
msg[514] = "WM_LBUTTONUP"
msg[521] = "WM_MBUTTONDBLCLK"
msg[519] = "WM_MBUTTONDOWN"
msg[520] = "WM_MBUTTONUP"
msg[546] = "WM_MDIACTIVATE"
msg[551] = "WM_MDICASCADE"
msg[544] = "WM_MDICREATE"
msg[545] = "WM_MDIDESTROY"
msg[553] = "WM_MDIGETACTIVE"
msg[552] = "WM_MDIICONARRANGE"
msg[549] = "WM_MDIMAXIMIZE"
msg[548] = "WM_MDINEXT"
msg[564] = "WM_MDIREFRESHMENU"
msg[547] = "WM_MDIRESTORE"
msg[560] = "WM_MDISETMENU"
msg[550] = "WM_MDITILE"
msg[44] = "WM_MEASUREITEM"
msg[288] = "WM_MENUCHAR"
msg[287] = "WM_MENUSELECT"
msg[33] = "WM_MOUSEACTIVATE"
msg[512] = "WM_MOUSEFIRST"
msg[521] = "WM_MOUSELAST"
msg[512] = "WM_MOUSEMOVE"
msg[3] = "WM_MOVE"
msg[534] = "WM_MOVING"
msg[134] = "WM_NCACTIVATE"
msg[131] = "WM_NCCALCSIZE"
msg[129] = "WM_NCCREATE"
msg[130] = "WM_NCDESTROY"
msg[132] = "WM_NCHITTEST"
msg[163] = "WM_NCLBUTTONDBLCLK"
msg[161] = "WM_NCLBUTTONDOWN"
msg[162] = "WM_NCLBUTTONUP"
msg[169] = "WM_NCMBUTTONDBLCLK"
msg[167] = "WM_NCMBUTTONDOWN"
msg[168] = "WM_NCMBUTTONUP"
msg[160] = "WM_NCMOUSEMOVE"
msg[133] = "WM_NCPAINT"
msg[166] = "WM_NCRBUTTONDBLCLK"
msg[164] = "WM_NCRBUTTONDOWN"
msg[165] = "WM_NCRBUTTONUP"
msg[40] = "WM_NEXTDLGCTL"
msg[78] = "WM_NOTIFY"
msg[85] = "WM_NOTIFYFORMAT"
msg[0] = "WM_NULL"
msg[15] = "WM_PAINT"
msg[777] = "WM_PAINTCLIPBOARD"
msg[38] = "WM_PAINTICON"
msg[785] = "WM_PALETTECHANGED"
msg[784] = "WM_PALETTEISCHANGING"
msg[528] = "WM_PARENTNOTIFY"
msg[770] = "WM_PASTE"
msg[896] = "WM_PENWINFIRST"
msg[911] = "WM_PENWINLAST"
msg[72] = "WM_POWER"
msg[536] = "WM_POWERBROADCAST"
msg[791] = "WM_PRINT"
msg[792] = "WM_PRINTCLIENT"
msg[1029] = "WM_PSD_ENVSTAMPRECT"
msg[1025] = "WM_PSD_FULLPAGERECT"
msg[1028] = "WM_PSD_GREEKTEXTRECT"
msg[1027] = "WM_PSD_MARGINRECT"
msg[1026] = "WM_PSD_MINMARGINRECT"
msg[1024] = "WM_PSD_PAGESETUPDLG"
msg[1030] = "WM_PSD_YAFULLPAGERECT"
msg[55] = "WM_QUERYDRAGICON"
msg[17] = "WM_QUERYENDSESSION"
msg[783] = "WM_QUERYNEWPALETTE"
msg[19] = "WM_QUERYOPEN"
msg[35] = "WM_QUEUESYNC"
msg[18] = "WM_QUIT"
msg[518] = "WM_RBUTTONDBLCLK"
msg[516] = "WM_RBUTTONDOWN"
msg[517] = "WM_RBUTTONUP"
msg[774] = "WM_RENDERALLFORMATS"
msg[773] = "WM_RENDERFORMAT"
msg[32] = "WM_SETCURSOR"
msg[7] = "WM_SETFOCUS"
msg[48] = "WM_SETFONT"
msg[50] = "WM_SETHOTKEY"
msg[128] = "WM_SETICON"
msg[11] = "WM_SETREDRAW"
msg[12] = "WM_SETTEXT"
msg[26] = "WM_SETTINGCHANGE"
msg[24] = "WM_SHOWWINDOW"
msg[5] = "WM_SIZE"
msg[779] = "WM_SIZECLIPBOARD"
msg[532] = "WM_SIZING"
msg[42] = "WM_SPOOLERSTATUS"
msg[125] = "WM_STYLECHANGED"
msg[124] = "WM_STYLECHANGING"
msg[262] = "WM_SYSCHAR"
msg[21] = "WM_SYSCOLORCHANGE"
msg[274] = "WM_SYSCOMMAND"
msg[263] = "WM_SYSDEADCHAR"
msg[260] = "WM_SYSKEYDOWN"
msg[261] = "WM_SYSKEYUP"
msg[82] = "WM_TCARD"
msg[30] = "WM_TIMECHANGE"
msg[275] = "WM_TIMER"
msg[576] = "WM_TOUCH"
msg[772] = "WM_UNDO"
msg[1024] = "WM_USER"
msg[84] = "WM_USERCHANGED"
msg[46] = "WM_VKEYTOITEM"
msg[277] = "WM_VSCROLL"
msg[778] = "WM_VSCROLLCLIPBOARD"
msg[71] = "WM_WINDOWPOSCHANGED"
msg[70] = "WM_WINDOWPOSCHANGING"
msg[26] = "WM_WININICHANGE"
-- export
winmsg = {}
local all = {}
-- add both numbers and strings as keys
for k,v in pairs(msg) do
winmsg[v] = k
winmsg[k] = v
all[#all+1] = k
end
winmsg.all = all