2006. augusztus 15., kedd

Custom message identifier: WM_APP +? or WM_USER +?


Problem/Question/Abstract:

I'm declaring a custom message identifier. Do I start from WM_APP or WM_USER?

Answer:

If you use a message internally in a custom control you typically base the message ID on WM_USER. If you use a custom message with a control derived from a standard windows or third-party control you are better off using WM_APP as the base, unless you definitely know from the documentation of the parent control what the highest message number it uses is (many controls use messages > WM_USER).

So it mainly depends in what context you intend to use the message. If only a TForm descendent will ever handle it you can base it on WM_USER since a form only handles messages < WM_USER or >= CM_BASE.

Nincsenek megjegyzések:

Megjegyzés küldése