11-07-2008, 09:06 AM
If the button is in your dialog, you can use WM_SETCURSOR message to detect when mouse is over, and EnableWindow to disable the button.
If it is in other program, and you cannot use an accessible trigger, then you can detect mouse movements using low level hooks (and also to block clicks), but it is not very easy, and it is not recommended to have many hooks.
Another idea - put an almost transparent toolbar over the button. On click, relay the click to the button or not.
Or enable the button when the condition is true, and disable when false.
If it is in other program, and you cannot use an accessible trigger, then you can detect mouse movements using low level hooks (and also to block clicks), but it is not very easy, and it is not recommended to have many hooks.
Another idea - put an almost transparent toolbar over the button. On click, relay the click to the button or not.
Or enable the button when the condition is true, and disable when false.