Custom Message Box: Windows' "Move Cursor to Default Button" Feature

Posted by Andreas Rejbrand on Stack Overflow See other posts from Stack Overflow or by Andreas Rejbrand
Published on 2010-03-11T14:38:12Z Indexed on 2010/03/11 21:14 UTC
Read the original article Hit count: 251

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about cursor

Related posts about default