Please help me check whats wrong with my code!!
my button supposed to be pressed when I click on it, and it still pressed even it loss focus, but my code seems to have problems, I duno y,, I couldn't figure it out,, please help me!
If I didn't commented for the messagebox before GetRegKey, the button works fine, but if I commented the messagebox out, the button doesn't seem to work,,
Please help me , thank you
here is my actual code:
Global variables:
TempBuffer dd ?
szSpButton db "software\SpButton\Button1",0
szPressed db "Pressed",0
in WM_CREATE:
;create button controls
invoke CreateWindowEx, NULL, addr szButtonClass, addr szCaption1,\
WS_CHILD or WS_VISIBLE, 55, 25, 40, 20, hWnd, ID_Button1, hInst, NULL
mov hButton1, eax
invoke GetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
.IF (TempBuffer==1)
invoke SendMessage, hButton1, BM_SETSTATE, BST_PUSHED, 0
.ENDIF
in WM_COMMAND:
mov eax, wParam
.IF (ax == ID_Button1)
;invoke MessageBox, 0, addr szSpButton, NULL, 0
invoke GetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax,
.IF (eax==0)
mov , 1
invoke SendMessage, hButton1, BM_SETSTATE, BST_PUSHED, 0
invoke SetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax, 1
ret
.ELSEIF (eax==1)
mov , 0
invoke SendMessage, hButton1, BM_SETSTATE, 0, 0
invoke SetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax, 1
ret
.ENDIF
.ENDIF
my button supposed to be pressed when I click on it, and it still pressed even it loss focus, but my code seems to have problems, I duno y,, I couldn't figure it out,, please help me!
If I didn't commented for the messagebox before GetRegKey, the button works fine, but if I commented the messagebox out, the button doesn't seem to work,,
Please help me , thank you
here is my actual code:
Global variables:
TempBuffer dd ?
szSpButton db "software\SpButton\Button1",0
szPressed db "Pressed",0
in WM_CREATE:
;create button controls
invoke CreateWindowEx, NULL, addr szButtonClass, addr szCaption1,\
WS_CHILD or WS_VISIBLE, 55, 25, 40, 20, hWnd, ID_Button1, hInst, NULL
mov hButton1, eax
invoke GetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
.IF (TempBuffer==1)
invoke SendMessage, hButton1, BM_SETSTATE, BST_PUSHED, 0
.ENDIF
in WM_COMMAND:
mov eax, wParam
.IF (ax == ID_Button1)
;invoke MessageBox, 0, addr szSpButton, NULL, 0
invoke GetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax,
.IF (eax==0)
mov , 1
invoke SendMessage, hButton1, BM_SETSTATE, BST_PUSHED, 0
invoke SetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax, 1
ret
.ELSEIF (eax==1)
mov , 0
invoke SendMessage, hButton1, BM_SETSTATE, 0, 0
invoke SetRegKey, addr szSpButton, addr szPressed, addr TempBuffer
mov eax, 1
ret
.ENDIF
.ENDIF
Anyone??
:rolleyes:
:rolleyes:
you should add The BS_PUSHBUTTON in CreateWindow because Button can be a Button or checkbox or Radiobutton or GroupBox, so put it.
and also change in WM_COMMAND
bye !
and also change in WM_COMMAND
.IF ax==ID_Button1
shr eax,16
.IF ax==BN_CLICKED
; ID_Button1 Clicked
bye !