Child Control Macros
The child control macros make it easier to send messages to child controls. They are very similar to the FORWARD_WM_*
macros. Each macro starts with the type of control you are sending the message to, followed by an underscore and the name of the message. For example, to send an LB_GETCOUNT
message to a list box, you use the following macro from WindowsX.h:
#define ListBox_GetCount(hwndCtl) \ ((int)(DWORD)SNDMSG((hwndCtl), LB_GETCOUNT, 0, 0L))
Let me point out a couple of things about this macro. First, SNDMSG
is a macro that maps to either SendMessage
or AfxSendMessage
in an MFC context. Second, it takes only one parameter, hwndCtl
, which is the window handle of the list box. Because the LB_GETCOUNT
message ignores the wParam ...
Get Windows® via C/C++, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.