O'Reilly logo

Windows® via C/C++, Fifth Edition by Christophe Nasarre, Jeffrey Richter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required