October 16th, 2009

Important window message numbers to memorize

You probably know them already, but if you’re new to Win32, here are some key window messages. I would normally suggest that you commit them to memory, but if you do enough debugging, you’ll end up memorizing them anyway because you see them all the time.

0x000F WM_PAINT
0x001A WM_WININICHANGE / WM_SETTINGCHANGE
0x0046 WM_WINDOWPOSCHANGING
0x0047 WM_WINDOWPOSCHANGED
0x004E WM_NOTIFY
0x010n WM_KEYxxx
0x0111 WM_COMMAND
0x0112 WM_SYSCOMMAND
0x0113 WM_TIMER
0x0200 WM_MOUSEMOVE
0x020n WM_MOUSExxx
0x0400 WM_USER
0x8000 WM_APP
0xCxxx RegisterWindowMessage

I include 0x001A in the list even though it is a low-traffic message because you do see it a lot when you are investigating hangs. The WM_SETTINGCHANGE (which also goes by the name WM_WININICHANGE) is a common culprit when investigating why your program has wedged: You’re broadcasting a notification and there’s a window in the system that isn’t responding.

I know that Visual Studio has a shortcut for decoding error codes. I wonder if it has one for decoding message numbers.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.