Page 64 - DCAP408_WEB_PROGRAMMING
P. 64
Windows Programming
Notes use the BS_OWNERDRAW button style and the
DRAWITEMSTRUCT structure for this task. The parent window of
the button obtains the BN_PUSHED notification code through the
WM_COMMANDmessage.
BN_SETFOCUS Sent when a button obtains the keyboard focus. The button must
have the BS_NOTIFY style to send this notification code. The parent
window of the button obtains the BN_SETFOCUS notification code
through the WM_COMMAND message.
BN_UNHILITE Sent when the highlight should be removed from a button. This
notification code is provided only for compatibility with 16-bit
versions of Windows earlier than version 3.0. Applications should
utilize the BS_OWNERDRAW button style and the
DRAWITEMSTRUCT structure for this task. The parent window of
the button obtains the BN_UNHILITE notification code via the
WM_COMMAND message.
BN_UNPUSHED Sent when the push state of a button is set to unpushed. This
notification code is provided only for compatibility with 16-bit
versions of Windows earlier than version 3.0. Applications should
use the BS_OWNERDRAW button style and the
DRAWITEMSTRUCT structure for this task. The parent window of
the button obtains the BN_UNPUSHED notification code via the
WM_COMMAND message.
NM_CUSTOMDRAW (button) Informs the parent window of a button control regarding custom
draw operations on the button. The button control sends this
notification code in the form of a WM_NOTIFY message.
WM_CTLCOLORBTN The WM_CTLCOLORBTN message is sent to the parent window of
a button before drawing the button. The parent window can modify
the button’s text and background colors. However, only
owner-drawn buttons react to the parent window processing this
message.
Task Make distinction between BN_CLICKED and BN_DOUBLECLICKED.
Self Assessment
Fill in the blanks:
6. From the user’s point of view, a ................................. is functional when clicked, in which
case the user places the mouse on it and presses one of the mouse’s buttons.
7. To close a dialog box, you can utilize the Win32 API’s ................................. function.
8. A notification code ................................. is send when the button is disabled.
4.6 List Boxes
List box is the last standard control which is considered as a handy tool.
4.6.1 Adding Items
The first thing you’ll desire to do with a listbox is add items to it.
int index = SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)”Hi
there!”);
58 LOVELY PROFESSIONAL UNIVERSITY