当前位置:网站首页>Accessing user interface settings using systemparametersinfo
Accessing user interface settings using systemparametersinfo
2022-06-24 07:22:00 【Topomeyer - long development road】
SystemParametersInfo This function is very useful , It can be used to access the user interface settings in the operating system in the form of code , And it is the only function that can be used to modify settings . In today's article , I won't list all the setup parameters supported by this function , If necessary , Please go out and turn left to read the document , That's where you need to go . I just want to say something worth noting :
> SPI_GETICONTITLELOGFONT
This parameter can be used to obtain the font information of the icon text . Corresponding ,SPI_SETICONTITLELOGFONT Can be used to modify .
> SPI_GETNONCLIENTMETRICS
This parameter can be used to get the window title , menu , Font information of status bar and message prompt box , Corresponding ,SPI_SETNONCLIENTMETRICS Can be used to modify .
Here are some corresponding parameters on the control panel :
> SPI_SETKEYBOARDDELAY and SPI_SETKEYBOARDSPEED It can be used to set the keyboard to automatically repeat relevant parameters .
> SPI_SETDOUBLECLICKTIME Can be used to set the mouse double-click speed .
> SPI_SETMENUFADE Can be used to enable or disable menu fade animation .
> There's another one SPI_SETxxxANIMATION Series parameters , It can be used to control which screen components can be animated .
Please note that , When using SPI_SET* When parameters are , You also need to indicate that the value to be set is temporary ( The settings become invalid after logging off ) It's permanent .SPIF_UPDATEINIFILE This flag specifies that the settings will be saved to the user profile . If this flag is turned off , The settings will not be saved , And it will be invalid when the user logs off . in addition , You also need to add SPIF_SENDCHANGE sign , In this way, programs that want to receive the setting change event can receive this notification and take corresponding actions .
Because the change of system settings can be temporary , It can also be permanent , This creates a potential problem : Programs that directly access the registry to read or write system settings may not work as expected . If the current setting is temporary , These settings will not be saved to the registry .SystemParametersInfo This function will get the current actual setting value , It also contains temporary settings that just reside in memory .
for instance , If you want to check whether the current menu has animation enabled , If the user has temporarily disabled the animation , If you judge by reading the registry , The value you read may be different from the current value . in addition , Those settings written to the registry change , It will only take effect the next time the user logs in , Because the new settings will be reloaded at this time .
If you want the settings to take effect immediately , have access to SystemParametersInfo This function . What still confuses me is , Why do people use undocumented registry entries to change these settings , Instead of using the system API To achieve . Especially when API Can work normally , When undocumented registry entries are less reliable .
I remember , There was an application , It is not provided by the system API, Instead, access undocumented registry keys directly ( I think I want to get the font of icon text. I remember ). But the surprise is , It reads the registry in Windows 2000 Changes have taken place in ( The program is oriented to Windows 95 platform ). If the developer uses a standardized API Come true , The program can run in the new version of the system without any changes .
let me put it another way , Developers try to bypass the most appropriate technical route , I used a method that I thought would be successful . But in the end, he lifted a stone and hit himself in the foot .
summary
If you want your program to survive longer , Please try to use standardized , Documented API.
TopomelBox Do not pursue strange sexual skills , But step by step according to the document , Sometimes I even see API Whether to mark as Obsolete.
Last
Raymond Chen Of 《The Old New Thing》 It's one of my favorite blogs , There's a lot about Windows Little knowledge , For the vast Windows For platform developers , It's really helpful .
This article is from :《Using SystemParametersInfo to access user interface settings》

边栏推荐
- Face pincher: a hot meta universe stylist
- bjdctf_2020_babystack
- 【Proteus】Arduino UNO + DS1307+LCD1602时间显示
- buuctf misc [UTCTF2020]docx
- Functions in setinterval cannot have parentheses
- Deploy loglistener in tke container to collect logs to CLS
- 华为云数据库进阶学习
- Bjdctf 2020 Bar _ Babystack
- Hyperledger fabric ledger snapshot - fast data synchronization
- 游戏思考14:对cache_server缓冲服务器的问题思考(读云峰博客有感)
猜你喜欢

【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码

Functions in setinterval cannot have parentheses

bjdctf_2020_babystack

在终端pip install xxx但在pycharm却no module named xxx

20个不容错过的ES6技巧

华为云图引擎服务

华为云数据库进阶学习
![[WordPress website] 5 Set code highlight](/img/01/f669b70f236c334b98527a9320400c.png)
[WordPress website] 5 Set code highlight

Introduction to raspberry pie 4B development board

JVM debugging tool -jvisualvm
随机推荐
Software performance test analysis and tuning practice path - JMeter's performance pressure test analysis and tuning of RPC Services - manuscript excerpts
How can genetic testing help patients fight disease?
1. go deep into tidb: see tidb for the first time
Face pincher: a hot meta universe stylist
第三方软件测试公司如何选择?2022国内软件测试机构排名
buuctf misc [UTCTF2020]docx
EasyDSS_ The dash version solves the problem that the RTSP source address cannot play the video stream
大厂不是衡量能力的唯一出路,上财学姐毕业三年的经验分享
电脑如何打开软键盘,教大家Win10如何打开软键盘的方法
[GUET-CTF2019]zips
0 foundation a literature club low code development member management applet (I)
如何删除/选择电脑上的输入法
【WordPress建站】6. 文章内容防复制
关于取模数据序号定位的说明 区码定位是指GBK编码
[signal recognition] signal modulation classification based on deep learning CNN with matlab code
利用微搭低代码实现级联选择
Why use lock [readonly] object? Why not lock (this)?
Accelerate large-scale data analysis based on Apache iceberg through data organization optimization
Stop looking! The most complete data analysis strategy of the whole network is here
软件性能测试分析与调优实践之路-JMeter对RPC服务的性能压测分析与调优-手稿节选