当前位置:网站首页>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
- A case study of apiserver avalanche caused by serviceaccount
- Unexpected token u in JSON at position 0
- Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
- 在产业互联网时代不再有真正意义上的中心,这些中心仅仅只是化有形为无形而已
- 两个链表的第一个公共节点_链表中环的入口(剑指offer)
- How to distinguish PAAS, IAAs and SaaS?
- Serviceworker working mechanism and life cycle: resource caching and collaborative communication processing
- Graduation season advance technology
- JVM调试工具-jps
猜你喜欢

Big factories are not the only way to measure ability. The three years' experience of Shangcai's graduation

蓝牙耳机怎么连接电脑使用,win10电脑如何连接蓝牙耳机
![[image fusion] image fusion based on NSST and PCNN with matlab code](/img/b4/61a5adde0d0bfc5a339ef8ab948d43.png)
[image fusion] image fusion based on NSST and PCNN with matlab code

【WordPress建站】5. 设置代码高亮

JVM debugging tool -arthas

The fund management of London gold is more important than others

RDD基础知识点

【信号识别】基于深度学习CNN实现信号调制分类附matlab代码

伦敦金的资金管理比其他都重要

关于取模数据序号定位的说明 区码定位是指GBK编码
随机推荐
【信号识别】基于深度学习CNN实现信号调制分类附matlab代码
电脑如何打开软键盘,教大家Win10如何打开软键盘的方法
Cisco router configuration notes: static routing, rip, OSPF, principles combined with experiments, worth a visit!
JVM debugging tool -jstack
1. go deep into tidb: see tidb for the first time
【图像融合】基于NSST结合PCNN实现图像融合附matlab代码
RDD基础知识点
Coding helps promote the internationalization of Tencent games
【图像融合】基于像素显着性结合小波变换实现多焦点和多光谱图像融合附matlab代码
学会使用楼宇控制系统BACnet网关没那么难
游戏思考14:对cache_server缓冲服务器的问题思考(读云峰博客有感)
Record the problem location experience when an application is suddenly killed
Mysql---三张表(student,课程,分数) 查询课程为数学的学生姓名,编号,成绩
JVM调试工具-Arthas
In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute
【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码
【TS】函数类型
PCL 计算多边形的面积
【Proteus】Arduino UNO + DS1307+LCD1602时间显示
Research on redis High Availability Mechanism