[python-win32] Programmatically turn off mouse auto-positioning
reckoner
reckoner at gmail.com
Fri Feb 7 14:29:05 CET 2014
> Am 04.02.2014 19:51, schrieb reckoner:
> > Hi,
> >
> > In the control panel, under mouse settings, there is a checkbox to
> > automatically move the mouse to the "default button in a dialog box".
> >
> > Is there a way to programmatically turn this off/on using Python? I'm
> > referring to windows 7/8.
> >
> > Thanks!
>
> SystemParametersInfo with the SPI_SETSNAPTODEFBUTTON parameter.
> No idea if pywin32 exposes this but there's always ctypes.
Thanks for the tip! For posterity, here it is:
def set_mouse_autosnap_to_default(state):
"""The mouse is auto-positioned in the control panel. This turns
on/off this
auto-snap.
:state: True/False (set to bool)
"""
h = ctypes.c_void_p()
# set postion
ctypes.windll.user32.SystemParametersInfoW(0x60,state,ctypes.byref(h),0)
# recover position
# print
ctypes.windll.user32.SystemParametersInfoW(0x5F,0,ctypes.byref(h),0)
More information about the python-win32
mailing list