WndProc site?

aewarnick

Senior Contributor
Joined
Jan 29, 2003
Messages
1,031
Do any of you use a site or know of one that will show all the windows messages and their Msg id's and also what they do?
 
most of them you will find in the header files of c++ like commonctrl.h although they will show as 0x00blabla not &A0 etc..
i've not found a site that lists each one but always found the api spy a very handy tool to use.
 
I am checking out api spy right now. Sadly, I don't think I will find much use for it but I'll hang onto it just in case. I didn't find anything of worth on MSDN either. The searches never got to any links I wanted.

By the way, how do you catch messages that are being send to a Control?
 
I have a trick, that is:
- Override the WndProc on your control that you want to investigate
- Print to console every message it received. (use the msg.ToString())
- So you will know WHEN and WHAT messages are send to the control (include msg value, lparam, rparam...)

You'll see there are a lot of messages :)
 
Visual Basic:
Public Enum WindowMessages
    WM_ACTIVATE = &H6
    WM_ACTIVATEAPP = &H1C
    WM_ASKCBFORMATNAME = &H30C
    WM_CANCELJOURNAL = &H4B
    WM_CANCELMODE = &H1F
    WM_CAPTURECHANGED = &H1F
    WM_CAPTURECHANGED_R = &H215
    WM_CHANGECBCHAIN = &H30D
    WM_CHAR = &H102
    WM_CHARTOITEM = &H2F
    WM_CHILDACTIVATE = &H22
    WM_CHOOSEFONT_GETLOGFONT = &H401
    WM_CHOOSEFONT_SETFLAGS = (&H400 + 102)
    WM_CHOOSEFONT_SETLOGFONT = (&H400 + 101)
    WM_CLEAR = &H303
    WM_CLOSE = &H10
    WM_COMMAND = &H111
    WM_COMPACTING = &H41
    WM_COMPAREITEM = &H39
    WM_CONTEXTMENU = &H7B
    WM_CONVERTREQUESTEX = &H108
    WM_COPY = &H301
    WM_COPYDATA = &H4A
    WM_CREATE = &H1
    WM_CTLCOLORBTN = &H135
    WM_CTLCOLORDLG = &H136
    WM_CTLCOLOREDIT = &H133
    WM_CTLCOLORLISTBOX = &H134
    WM_CTLCOLORMSGBOX = &H132
    WM_CTLCOLORSCROLLBAR = &H137
    WM_CTLCOLORSTATIC = &H138
    WM_CUT = &H300
    WM_DDE_ACK = (&H3E0 + 4)
    WM_DDE_ADVISE = (&H3E0 + 2)
    WM_DDE_DATA = (&H3E0 + 5)
    WM_DDE_EXECUTE = (&H3E0 + 8)
    WM_DDE_FIRST = &H3E0
    WM_DDE_INITIATE = &H3E0
    WM_DDE_LAST = (&H3E0 + 8)
    WM_DDE_POKE = (&H3E0 + 7)
    WM_DDE_REQUEST = (&H3E0 + 6)
    WM_DDE_TERMINATE = (&H3E0 + 1)
    WM_DDE_UNADVISE = (&H3E0 + 3)
    WM_DEADCHAR = &H103
    WM_DELETEITEM = &H2D
    WM_DESTROY = &H2
    WM_DESTROYCLIPBOARD = &H307
    WM_DEVICECHANGE = &H219
    WM_DEVMODECHANGE = &H1B
    WM_DRAWCLIPBOARD = &H308
    WM_DRAWITEM = &H2B
    WM_DROPFILES = &H233
    WM_ENABLE = &HA
    WM_ENDSESSION = &H16
    WM_ENTERIDLE = &H121
    WM_ENTERSIZEMOVE = &H231
    WM_ENTERMENULOOP = &H211
    WM_ERASEBKGND = &H14
    WM_EXITMENULOOP = &H212
    WM_EXITSIZEMOVE = &H232
    WM_FONTCHANGE = &H1D
    WM_GETDLGCODE = &H87
    WM_GETFONT = &H31
    WM_GETHOTKEY = &H33
    WM_GETMINMAXINFO = &H24
    WM_GETTEXT = &HD
    WM_GETTEXTLENGTH = &HE
    WM_HELP = &H53
    WM_HOTKEY = &H312
    WM_HSCROLL = &H114
    WM_HSCROLLCLIPBOARD = &H30E
    WM_ICONERASEBKGND = &H27
    WM_IME_CHAR = &H286
    WM_IME_COMPOSITION = &H10F
    WM_IME_COMPOSITIONFULL = &H284
    WM_IME_CONTROL = &H283
    WM_IME_ENDCOMPOSITION = &H10E
    WM_IME_KEYDOWN = &H290
    WM_IME_KEYLAST = &H10F
    WM_IME_KEYUP = &H291
    WM_IME_NOTIFY = &H282
    WM_IME_SELECT = &H285
    WM_IME_SETCONTEXT = &H281
    WM_IME_STARTCOMPOSITION = &H10D
    WM_INITDIALOG = &H110
    WM_INITMENU = &H116
    WM_INITMENUPOPUP = &H117
    WM_INPUTLANGCHANGEREQUEST = &H50
    WM_INPUTLANGCHANGE = &H51
    WM_KEYDOWN = &H100
    WM_KEYUP = &H101
    WM_KILLFOCUS = &H8
    WM_LBUTTONDBLCLK = &H203
    WM_LBUTTONDOWN = &H201
    WM_LBUTTONUP = &H202
    WM_MBUTTONDBLCLK = &H209
    WM_MBUTTONDOWN = &H207
    WM_MBUTTONUP = &H208
    WM_MDIACTIVATE = &H222
    WM_MDICASCADE = &H227
    WM_MDICREATE = &H220
    WM_MDIDESTROY = &H221
    WM_MDIGETACTIVE = &H229
    WM_MDIICONARRANGE = &H228
    WM_MDIMAXIMIZE = &H225
    WM_MDINEXT = &H224
    WM_MDIREFRESHMENU = &H234
    WM_MDIRESTORE = &H223
    WM_MDISETMENU = &H230
    WM_MDITILE = &H226
    WM_MEASUREITEM = &H2C
    WM_MENUCHAR = &H120
    WM_MENUSELECT = &H11F
    WM_MENURBUTTONUP = &H122
    WM_MENUDRAG = &H123
    WM_MENUGETOBJECT = &H124
    WM_MENUCOMMAND = &H126
    WM_MOUSEACTIVATE = &H21
    WM_MOUSEHOVER = &H2A1
    WM_MOUSELEAVE = &H2A3
    WM_MOUSEMOVE = &H200
    WM_MOUSEWHEEL = &H20A
    WM_MOVE = &H3
    WM_MOVING = &H216
    WM_NCACTIVATE = &H86
    WM_NCCALCSIZE = &H83
    WM_NCCREATE = &H81
    WM_NCDESTROY = &H82
    WM_NCHITTEST = &H84
    WM_NCLBUTTONDBLCLK = &HA3
    WM_NCLBUTTONDOWN = &HA1
    WM_NCLBUTTONUP = &HA2
    WM_NCMBUTTONDBLCLK = &HA9
    WM_NCMBUTTONDOWN = &HA7
    WM_NCMBUTTONUP = &HA8
    WM_NCMOUSEMOVE = &HA0
    WM_NCPAINT = &H85
    WM_NCRBUTTONDBLCLK = &HA6
    WM_NCRBUTTONDOWN = &HA4
    WM_NCRBUTTONUP = &HA5
    WM_NEXTDLGCTL = &H28
    WM_NEXTMENU = &H213
    WM_NULL = &H0
    WM_PAINT = &HF
    WM_PAINTCLIPBOARD = &H309
    WM_PAINTICON = &H26
    WM_PALETTECHANGED = &H311
    WM_PALETTEISCHANGING = &H310
    WM_PARENTNOTIFY = &H210
    WM_PASTE = &H302
    WM_PENWINFIRST = &H380
    WM_PENWINLAST = &H38F
    WM_POWER = &H48
    WM_POWERBROADCAST = &H218
    WM_PRINT = &H317
    WM_PRINTCLIENT = &H318
    WM_PSD_ENVSTAMPRECT = (&H400 + 5)
    WM_PSD_FULLPAGERECT = (&H400 + 1)
    WM_PSD_GREEKTEXTRECT = (&H400 + 4)
    WM_PSD_MARGINRECT = (&H400 + 3)
    WM_PSD_MINMARGINRECT = (&H400 + 2)
    WM_PSD_PAGESETUPDLG = (&H400)
    WM_PSD_YAFULLPAGERECT = (&H400 + 6)
    WM_QUERYDRAGICON = &H37
    WM_QUERYENDSESSION = &H11
    WM_QUERYNEWPALETTE = &H30F
    WM_QUERYOPEN = &H13
    WM_QUEUESYNC = &H23
    WM_QUIT = &H12
    WM_RBUTTONDBLCLK = &H206
    WM_RBUTTONDOWN = &H204
    WM_RBUTTONUP = &H205
    WM_RENDERALLFORMATS = &H306
    WM_RENDERFORMAT = &H305
    WM_SETCURSOR = &H20
    WM_SETFOCUS = &H7
    WM_SETFONT = &H30
    WM_SETHOTKEY = &H32
    WM_SETREDRAW = &HB
    WM_SETTEXT = &HC
    WM_SETTINGCHANGE = &H1A
    WM_SHOWWINDOW = &H18
    WM_SIZE = &H5
    WM_SIZING = &H214
    WM_SIZECLIPBOARD = &H30B
    WM_SPOOLERSTATUS = &H2A
    WM_SYSCHAR = &H106
    WM_SYSCOLORCHANGE = &H15
    WM_SYSCOMMAND = &H112
    WM_SYSDEADCHAR = &H107
    WM_SYSKEYDOWN = &H104
    WM_SYSKEYUP = &H105
    WM_TIMECHANGE = &H1E
    WM_TIMER = &H113
    WM_UNDO = &H304
    WM_USER = &H400
    WM_VKEYTOITEM = &H2E
    WM_VSCROLL = &H115
    WM_VSCROLLCLIPBOARD = &H30A
    WM_WINDOWPOSCHANGED = &H47
    WM_WINDOWPOSCHANGING = &H46
    WM_WININICHANGE = &H1A
    WM_APPCOMMAND = &H319
End Enum
 
Good job Merrion. If only I had definitions including parameters...
Thank you Night. So I can treat a control just like a form.
 
WM_ACTIVATEAPP

This message is sent to the top level window of an application when that application gains or loses the focus. i.e. when the user ALT+TAB switches to/from it or clicks on the application in the task bar etc.

wParam - This is non-zero if your application is gaining the focus, and zero if it is losing the focus.

lParam - This is the thread handle of the other application. If your application gains the focus this is the thread handle of the application that lost the focus and if your application loses the focus this is the thread handle of the application that will get the focus next.
 
WM_CAPTURECHANGED

This message is sent to a window when it gains of loses the mouse capture, either as a result of the user or by the SetCapture API call.

wParam - This parameter is ignored

lParam - The window handle of the window which is gaining the focus.
 
WM_CHAR

This message is posted to a window when a keyboard key is pressed (other than ALT) and the window has the input focus.

wParam - This is the virtual key number which corresponds to the vbKey constants like vbKeyA if key "A" was pressed.

lParam - This holds additional information about the key press.
Bits 0-15 is the repetition count (when a key is held down)
Bits 16-23 is the scan code of the key - this is dependednt on the actual keyboard hardware
Bit 29 is set if the ALT key is down
Bit 30 is set if the key was already down i.e. the event is due to a key repetition
Bit 31 is set if the ke is being pressed, i.e. opposite to bit 30
 
WM_COMPACTING

This message is sent to all top level windows when the operating system is running low on memory and is compacting the memory.

wParam - The amount of time spent compacting : the higher this number is the more trouble windows is having freeing up memory

lParam - Unused (set to zero)
 
WM_MOVE

This message is sent to a window when it has been moved. Not so useful now that VB at last has a Move event.

wParam - Unused, set to zero

lParam The upper 16 bits (HIWORD) hold the vertical (y) position of the window after the move, and the lower 16 bits (LOWORD) holds the horizontal(x) position of the window after the move.

You can use this message to be notified whenever a user moves a form.
 
WM_NCLBUTTONDOWN , WM_NCMBUTTONDOWN , WM_NCRBUTTONDOWN

The mouse button (left, middle or right respectively) was pressed down while the pointer was over the non-client area of the window.

WM_NCLBUTTONUP , WM_NCMBUTTONUP , WM_NCRBUTTONUP
The mouse button (left, middle or right respectively) was released while the pointer was over the non-client area of the subclassed window.

WM_NCMOUSEMOVE
The mouse moved over the non client area of the form

wParam - The bit of the non client area which the mouse event occured over. This can be one of:
Visual Basic:
Public Enum enHitTestResult
    HTBORDER = 18
    HTBOTTOM = 15
    HTBOTTOMLEFT = 16
    HTBOTTOMRIGHT = 17
    HTCAPTION = 2
    HTCLIENT = 1
    HTERROR = (-2)
    HTGROWBOX = 4
    HTHSCROLL = 6
    HTLEFT = 10
    HTMAXBUTTON = 9
    HTMENU = 5
    HTMINBUTTON = 8
    HTNOWHERE = 0
    HTRIGHT = 11
    HTSYSMENU = 3
    HTTOP = 12
    HTTOPLEFT = 13
    HTTOPRIGHT = 14
    HTVSCROLL = 7
    HTTRANSPARENT = (-1)
    HTOBJECT = 19
    HTCLOSE = 20
    HTHELP = 21
End Enum

lParam - The lower 16 bits are an unsigned integer representing the x position of the mouse pointer when the event occured and the upper 16 bits are an unsigned integer representing the y position of the pointer.
 
Back
Top