Difference between messages with CN and WM prefixes

  • A+

When looking at Delphi source code, I often see messages declarations from the Windows API, such as CN_NOTIFY and WM_NOTIFY. I would like to know the differences between them and when they should be used?


WM messages are used by the Win32 API, and end user code.

CM and CN messages are used internally by the VCL.

When the VCL processes certain WM notifications from the Win32 API, like WM_COMMAND and WM_NOTIFY, which are sent from a child control to its parent window, the VCL reflects them as CN messages (CN_COMMAND and CN_NOTIFY) back to the child that sent them. This allows VCL controls to handle their own notifications.


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: