Re: Detecting button push
From: b010310 (pascal.vanpuymbroeck_at_zenonproductions.be)
Date: 12/27/04
- Next message: Alexander Grigoriev: "Re: Chinese and Japanese characters show up as '???????????' in Listbox control on Windows 2000"
- Previous message: UM: "Chinese and Japanese characters show up as '???????????' in Listbox control on Windows 2000"
- In reply to: David Olsson: "Detecting button push"
- Next in thread: Jason Doucette: "Re: Detecting button push"
- Reply: Jason Doucette: "Re: Detecting button push"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Dec 2004 15:45:17 GMT
David Olsson wrote:
> I have a window with a number of buttons (created using CreateWindow
> with the BS_PUSHBUTTON style). I would like to be able to detect when
> the user pushes these buttons (not when they have been pushed and
> released, i.e. clicked, but only the push part). Detecting if a button
> has been released is easy as it is simply a matter of catching the
> BN_CLICKED notification. I have however not been able to find any way of
> detecting only the push part. There is the possibility of adding
> BS_NOTIFY to the style of the buttons and catch BN_PUSHED notifications
> but this is depracted according to the SDK and furthermore doesn't seem
> to work. Any ideas?
>
> Thanks in advance!
> David Olsson
To me it seems as if you need this....
The WM_LBUTTONDOWN message is posted when the user presses the left
mouse button while the cursor is in the client area of a window. If the
mouse is not captured, the message is posted to the window beneath the
cursor. Otherwise, the message is posted to the window that has captured
the mouse.
WM_LBUTTONDOWN
fwKeys = wParam; // key flags
xPos = LOWORD(lParam); // horizontal position of cursor
yPos = HIWORD(lParam); // vertical position of cursor
Parameters
fwKeys
Value of wParam. Indicates whether various virtual keys are down. This
parameter can be any combination of the following values:
Value Description
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
xPos
Value of the low-order word of lParam. Specifies the x-coordinate of the
cursor. The coordinate is relative to the upper-left corner of the
client area.
yPos
Value of the high-order word of lParam. Specifies the y-coordinate of
the cursor. The coordinate is relative to the upper-left corner of the
client area.
Return Values
If an application processes this message, it should return zero.
Remarks
An application can use the MAKEPOINTS macro to convert the lParam
parameter to a POINTS structure.
See Also
GetCapture, MAKEPOINTS, POINTS, SetCapture, WM_LBUTTONDBLCLK, WM_LBUTTONUP
Happy coding !
Pascal.
- Next message: Alexander Grigoriev: "Re: Chinese and Japanese characters show up as '???????????' in Listbox control on Windows 2000"
- Previous message: UM: "Chinese and Japanese characters show up as '???????????' in Listbox control on Windows 2000"
- In reply to: David Olsson: "Detecting button push"
- Next in thread: Jason Doucette: "Re: Detecting button push"
- Reply: Jason Doucette: "Re: Detecting button push"
- Messages sorted by: [ date ] [ thread ]