开发者

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

开发者 https://www.devze.com 2022-12-22 10:50 出处:网络
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").

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.

开发者_JS百科

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

(source: rejbrand.se)

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?


Call SystemParametersInfo() with SPI_GETSNAPTODEFBUTTON

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号