News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Double Action Button

Started by ofg, December 25, 2004, 08:01:18 PM

Previous topic - Next topic

ofg

 hi,
     I have a Button Control as a Child Window.
     The system performs no action on my application when LB is pressed
     but after it is released.
     I want to carry out another action when LB is pressed too.
     Is there anything I can do ?

     thanks.

pbrennick

ofg,

QuoteThe BN_PUSHED notification message is sent when the push state of a button is set to pushed. The parent window of the button receives this notification message through the WM_COMMAND message.

I found that in the win32.hlp file, there is a lot of other stuff in Button Messages, such as:

QuoteFollowing are the messages used with buttons.

BM_CLICK
BM_GETCHECK
BM_GETIMAGE
BM_GETSTATE
BM_SETCHECK
BM_SETIMAGE
BM_SETSTATE
BM_SETSTYLE
BN_CLICKEDBN_DBLCLK
BN_DISABLE
BN_DOUBLECLICKED
BN_HILITE
BN_KILLFOCUS
BN_PAINT
BN_PUSHED
BN_SETFOCUS
BN_UNHILITE
BN_UNPUSHED
WM_CTLCOLORBTN

Paul


donkey

You can subclass the button and process the WM_LBUTTONDOWN message. It will be sent when the button is pressed down, a WM_LBUTTONUP message is sent when the button is released. It should be noted that this behaviour is by design, it allows the user to move the cursor off the button and release the left button cancelling the button press. To subclass the button do as follows...

invoke SetWindowLong,[hButton],GWL_WNDPROC,offset ButtonSubProc
mov [pButtonProc],eax

ButtonSubProc FRAME hWin,uMsg,wParam, lParam

cmp uMsg, WM_LBUTTONDOWN
jne >.DEFPROC
; do your thing here

.DEFPROC
invoke CallWindowProc,[pButtonProc],[hWin],[uMsg],[wParam],[lParam]
ret
ENDF
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Manos

#3
Also you can handle the BN_SETFOCUS and after send to Button the message:WM_KILLFOCUS

Manos.