What are the Parameters for in: Python, ctypes.windll.user32.SystemParametersInfoA?

依然范特西╮ 提交于 2021-01-28 06:06:19

问题


What do the 20, 0 and 3 mean in the Python function:

SPI_SETDESKWALLPAPER=20 
ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER,0,'imgpath', 3)

I'm quite new and haven't found any useful information. Also, can I define how the Wallpaper behaves, like stretch or tile or center?


回答1:


The SystemParametersInfoA function is a direct Windows interface. It is a C interface that in this case we are calling from Python. But it is structured the way it is because it was designed to be called from C. The interface can do a variety of things, and that variety is controlled by the integer value of the first parameter. In this case, the value is:

SPI_SETDESKWALLPAPER = 20

The SPI_SETDESKWALLPAPER name is used because this is how it will be referenced in all of the Windows Documentation. The SystemParametersInfoA function takes four parameters, the purpose of the last three vary depending on the function. In this case the 0 is unused. The purpose of the imgpath is self evident, but it does need to be a full path. Finally, the 3 is two bit flags:

SPIF_UPDATEINIFILE = 0x01
SPIF_SENDWININICHANGE = 0x02

This (Source) also has details on sizing the wallpaper.



来源:https://stackoverflow.com/questions/44474073/what-are-the-parameters-for-in-python-ctypes-windll-user32-systemparametersinf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!