Home   Index   About
Ultimate Pack


Custom Search
Button Default Message Processing

The window procedure for the predefined button control window class carries out default processing for all messages that the button control procedure does not process. When the button control procedure returns FALSE for any message, the predefined window procedure checks the messages and performs the default actions listed in the following table.

Message
Default action


BM_CLICK
Sends the button a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and sends the parent window a BN_CLICKED notification message.
BM_GETCHECK
Returns the check state of the button.
BM_GETIMAGE
Returns the handle of the bitmap or icon associated with the button or NULL if the button has no bitmap or icon.
BM_GETSTATE
Returns the current check state, push state, and focus state of the button.
BM_SETCHECK
Sets the check state for all styles of radio buttons and check boxes. If the wParam parameter is greater than zero for radio buttons, the button is given the WS_TABSTOP style.
BM_SETIMAGE
Associates the specified bitmap or icon handle with the button and returns the handle of the previous bitmap or icon.
BM_SETSTATE
Sets the push state of the button. For owner-drawn buttons, a WM_DRAWITEM message is sent to the parent window if the state of the button has changed.
BM_SETSTYLE
Sets the button style. If the low-order word of the lParam parameter is TRUE, the button is redrawn.
WM_CHAR
Checks a check box or automatic check box when the user presses the plus (+) or equal (=) keys. Unchecks a check box or automatic check box when the user presses the minus (pics/WIN3200090000.gif) key.
WM_ENABLE
Paints the button.
WM_ERASEBKGND
Erases the background for owner-drawn buttons. The backgrounds of other buttons are erased as part of the WM_PAINT and WM_ENABLE processing.
WM_GETDLGCODE
Returns values indicating the type of input processed by the default button procedure, as shown in the following table.

Button style
Returns
BS_AUTOCHECKBOX


DLGC_WANTCHARS | DLGC_BUTTON
BS_AUTORADIOBUTTON


DLGC_RADIOBUTTON
BS_CHECKBOX


DLGC_WANTCHARS | DLGC_BUTTON
BS_DEFPUSHBUTTON


DLGC_DEFPUSHBUTTON
BS_GROUPBOX


DLGC_STATIC
BS_PUSHBUTTON


DLGC_UNDEFPUSHBUTTON
BS_RADIOBUTTON


DLGC_RADIOBUTTON

WM_GETFONT
Returns a handle of the current font.
WM_KEYDOWN
Pushes the button if the user presses the SPACEBAR.
WM_KEYUP
Releases the mouse capture for all cases except the TAB key.
WM_KILLFOCUS
Removes the focus rectangle from a button. For push buttons and default push buttons, the focus rectangle is invalidated. If the button has the mouse capture, the capture is released, the button is not clicked, and any push state is removed.
WM_LBUTTONDBLCLK
Sends a BN_DBLCLK notification message to the parent window for radio buttons and owner-drawn buttons. For other buttons, a double-click is processed as a WM_LBUTTONDOWN message.
WM_LBUTTONDOWN
Highlights the button if the position of the mouse cursor is within the button's client rectangle.
WM_LBUTTONUP
Releases the mouse capture if the button had the mouse capture.
WM_MOUSEMOVE
Performs the same action as WM_LBUTTONDOWN, if the button has the mouse capture. Otherwise, no action is performed.
WM_NCCREATE
Turns any BS_OWNERDRAW button into a BS_PUSHBUTTON button.
WM_NCHITTEST
Returns HTTRANSPARENT, if the button control is a group box.
WM_PAINT
Draws the button according to its style and current state.
WM_SETFOCUS
Draws a focus rectangle on the button getting the focus. For radio buttons and automatic radio buttons, the parent window is sent a BN_CLICKED notification message.
WM_SETFONT
Sets a new font and optionally updates the window.
WM_SETTEXT
Sets the text of the button. In the case of a group box, the message paints over the preexisting text before repainting the group box with the new text.
WM_SYSKEYUP
Releases the mouse capture for all cases except the TAB key.

The predefined window procedure passes all other messages to the DefWindowProc function for default processing.


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2012 Free Tech Secrets ;) greatis just4fun network just4fun