Custom Message Box: Windows' "Move Cursor to Default Button" Feature
- by Andreas Rejbrand
In Microsoft Windows, there is a (highly useful) feature that automatically moves the cursor to the default button of a modal dialog box (activated in Win+R, "control mouse").
Now I have created a custom dialog box in Delphi (basically a TForm), see below.
But, quite naturally, the cursor does not automatically move to the default button ("Yes" in this case), even though the feature is turned on in "control mouse".
How to implement this feature using Windows API? I guess it would be sufficient to obtain the settings as a boolean (true if feature activated, false if not), and then simply move the cursor programmatically using SetCursorPos if true. But how to obtain this setting?