Hi everyone i need some help with my calculator project that i am doing. if i make the buttons using the following code how do i detect that a specific button has been clicked on
for example the code makes the buttons 1 , 2 and 3
the code
.elseif uMsg == WM_CREATE
jmp @F
Butn1 db "&1",0
Butn2 db "&2",0
Butn3 db "&3",0
@@:
invoke PushButton,ADDR Butn1,hWin,350,30,100,25,500
invoke PushButton,ADDR Butn2,hWin,350,60,100,25,500
invoke PushButton,ADDR Butn3,hWin,350,90,100,25,500
PushButton proc lpText:DWORD,hParent:DWORD,
a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD
szText btnClass,"BUTTON"
invoke CreateWindowEx,0,
ADDR btnClass,lpText,
WS_CHILD or WS_VISIBLE,
a,b,wd,ht,hParent,ID,
hInstance,NULL
ret
PushButton endp
can anyone explain how this would work so if they click on 1 i can detect it
thanks
for example the code makes the buttons 1 , 2 and 3
the code
.elseif uMsg == WM_CREATE
jmp @F
Butn1 db "&1",0
Butn2 db "&2",0
Butn3 db "&3",0
@@:
invoke PushButton,ADDR Butn1,hWin,350,30,100,25,500
invoke PushButton,ADDR Butn2,hWin,350,60,100,25,500
invoke PushButton,ADDR Butn3,hWin,350,90,100,25,500
PushButton proc lpText:DWORD,hParent:DWORD,
a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD
szText btnClass,"BUTTON"
invoke CreateWindowEx,0,
ADDR btnClass,lpText,
WS_CHILD or WS_VISIBLE,
a,b,wd,ht,hParent,ID,
hInstance,NULL
ret
PushButton endp
can anyone explain how this would work so if they click on 1 i can detect it
thanks
Don't use the same ID for each button.
The WM_COMMAND message with notification code BN_CLICK will supply the ID of the button that was clicked.
The WM_COMMAND message with notification code BN_CLICK will supply the ID of the button that was clicked.