Created an attachment (id=6968)
Sample program demonstrating bug in BM_CLICK handling
The BM_CLICK message translates into a WM_LBUTTONDOWN and a WM_LBUTTONUP message being sent to the button. These messages result in a BN_CLICKED notification.
On MS Windows, sending a BM_CLICK message has no effect while handling the WM_LBUTTONDOWN message that comes from another BM_CLICK message. On ReactOS (and Wine) this results in nested WM_LBUTTONDOWN messages and BN_CLICKED notifications.
I've attached a simple program that demonstrates this behavior. It creates a window with a button. The button is subclassed to intercept WM_LBUTTONDOWN. When clicking the button, it starts counting the BN_CLICKED notifications and sends a BM_CLICK message. After this message it displays the number of received BN_CLICKED notifications. When the button receives a WM_LBUTTONDOWN message and the test is currently running, the sample sends a new BM_CLICK message.
I've also implemented a check to definitly stop sending BM_CLICK after a while, so the program doesn't loop forever.
On MS Windows the sample always counts exactly 1 BN_CLICKED notification. On ReactOS it always runs until the check for the endless loop fires and counts more than 1 BN_CLICKED notification.
I suggest to extend the BM_CLICK handler in the button control like this:
inBMClick = TRUE;
inBMClick = FALSE;