I have a button, and when someone clicks it, it increases a number. How do i make it so when someone holds it down, it performs the code for that button over and over?
in your BN_CLICKED event you need to do a loop until statements. found something else to add. An application sends a BM_GETSTATE message to determine the state of a button. check it and see if its return value is set to 0 and if it is then the button is no longer pushed. if your looking for some asm code on that im not gonna be able to help u in that department. im still a newbie so take this sugestion lightly. smurf This message was edited by smurf, on 3/25/2001 6:44:58 PM This message was edited by smurf, on 3/25/2001 6:45:26 PM This message was edited by smurf, on 3/25/2001 7:00:55 PM
It didnt work. I think it didnt work because the BN_CLICKED message isnt sent until after youve let go of the button. Is there a message thats sent when you press the button down?
My suggestion, and it just off the top of my pointy little head :), Evaluate for both BUTTON DOWN and BUTTON UP messages... ON the BUTTON DOWN for the specific button, start a timmer which will create TIMER events every x seconds. On the BUTTON UP, kill the timer. Then move your code to the timmer event. NaN
There's always WM_LBUTTONDOWN, that's gonna fire at the start of the click. You might subclass a button to grab this message, then start a timer with a longer ititial delay (500 ms or so), then shorter repeat delay (50ms), so it works just like when you press down a single key and it repeatssssssssssssssss. Just make sure the mouse is still over and L button is down as you do the timer's increase. ------------------------ "Always remember that youíre representing your country. I guess what Iím saying is, donít mess up France the way you messed up your room."
NaN: I looked through my help file, and i couldnt find any message that was sent when the button was pressed and held down. Ernie: That sounded good, but i tryed it, and the WM_LBUTTONDOWN isnt sent when you click on a button.