当前位置:网站首页>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》

边栏推荐
- 華為雲數據庫進階學習
- 【图像特征提取】基于脉冲耦合神经网络(PCNN)实现图像特征提取含Matlab源码
- 使用SystemParametersInfo访问用户界面设置
- 【Cnpm】使用教程
- PCL 点云按比率随机采样
- Functions in setinterval cannot have parentheses
- The third session of freshman engineering education seminar is under registration
- [DDCTF2018](╯°□°)╯︵ ┻━┻
- Development of IOT device end - establishment of development environment
- JVM debugging tool -jvisualvm
猜你喜欢

In JS, the regular expression verifies the hour and minute, and converts the input string to the corresponding hour and minute

20 not to be missed ES6 tips

JVM调试工具-Arthas

JVM debugging tool -jvisualvm

Huawei cloud image engine service
╯︵ ┻━┻](/img/26/6986a8ae6c00eb2431a082dc0ff978.png)
[DDCTF2018](╯°□°)╯︵ ┻━┻
![[Proteus] Arduino uno + ds1307+lcd1602 time display](/img/96/d8c1cacc8a633c679b1a58a1eb8cb9.png)
[Proteus] Arduino uno + ds1307+lcd1602 time display

蓝牙耳机怎么连接电脑使用,win10电脑如何连接蓝牙耳机

Mysql---三张表(student,课程,分数) 查询课程为数学的学生姓名,编号,成绩

【图像融合】基于方向离散余弦变换和主成分分析的图像融合附matlab代码
随机推荐
Coding helps promote the internationalization of Tencent games
JVM調試工具-Arthas
[GUET-CTF2019]zips
树莓派4B开发板入门
[TS] function type
A case study of apiserver avalanche caused by serviceaccount
Bay area enterprises quick look! The focus of the data regulations of Shenzhen Special Economic Zone just released is coming!
游戏思考14:对cache_server缓冲服务器的问题思考(读云峰博客有感)
Summary of 2022 blue team HW elementary interview questions
自动化测试是什么?什么软件项目适合自动化测试?
前缀和专题训练
[image fusion] image fusion based on NSST and PCNN with matlab code
[image feature extraction] image feature extraction based on pulse coupled neural network (PCNN) including Matlab source code
2、 What is the principle of layer 3 and 4 switching technology? Recommended collection!
第三方软件测试公司如何选择?2022国内软件测试机构排名
Deploy loglistener in tke container to collect logs to CLS
Audio knowledge (V) -- data processing
Can the small fire Chunfeng tea make its debut by "keeping fit"?
如何删除/选择电脑上的输入法
20 not to be missed ES6 tips