无忧启动论坛

标题: WinXShell自动更改DPI [打印本页]

作者: as8686886    时间: 2024-4-4 14:58
标题: WinXShell自动更改DPI
本帖最后由 as8686886 于 2024-4-4 17:30 编辑

在WinXshell的WinXShell.lua里发现以下一段代码:
  1. -- 根据DPI自动切换屏幕分辨率
  2. function MyDisplayChangedHandler()
  3.   local cur_res_x = Screen:GetX()
  4.   if last_res_x == cur_res_x then return end
  5.   last_res_x = cur_res_x
  6.   if last_res_x >= 3840 then
  7.     Screen:DPI(150)
  8.   elseif last_res_x >= 1440 then
  9.     Screen:DPI(125)
  10.   elseif last_res_x >= 800 then
  11.     Screen:DPI(100)
  12.   end
  13. end
复制代码
这段代码如何调用呢?
winxshell.exe -script WinXShell.lua 没有任何效果
将函数名function MyDisplayChangedHandler()改为function ondisplaychanged再通过
  1. EXEC !"%ProgramFiles%\WinXShell\WinXShell.exe" -regist -daemon
  2. EXEC %ProgramFiles%\WinXShell\WinXShell.exe -ondisplaychanged
复制代码
调用也没效果!


作者: hua_wuxin    时间: 2024-4-4 15:42
EXEC %ProgramFiles%\WinXShell\WinXShell.exe -luacode "MyDisplayChangedHandler()"

作者: slore    时间: 2024-4-4 15:42
这个函数是 WinXShell 作为外壳时,当系统分辨率变化后,根据分辨率尺寸进行自动调整DPI。

你是Explorer.exe外壳环境运行麽。
作者: yyz2191958    时间: 2024-4-4 15:45
进来学习
作者: as8686886    时间: 2024-4-4 17:22
slore 发表于 2024-4-4 15:42
这个函数是 WinXShell 作为外壳时,当系统分辨率变化后,根据分辨率尺寸进行自动调整DPI。

你是Explorer ...

是Explorer环境
作者: as8686886    时间: 2024-4-4 17:25
hua_wuxin 发表于 2024-4-4 15:42
EXEC %ProgramFiles%\WinXShell\WinXShell.exe -luacode "MyDisplayChangedHandler()"

这个命令可以,Explorer模式下可以用,多谢!
作者: yc2428    时间: 2024-4-4 18:37
学习
作者: hehuiying    时间: 2024-4-6 04:52
谢谢分享
作者: vyuha    时间: 2024-4-17 21:11
777
作者: 无犹启动    时间: 2024-5-6 17:17
谢谢分享
作者: shanghui6666    时间: 2024-5-6 17:37
谢谢大佬分享!!!
作者: martin313    时间: 2024-6-8 07:26

路过,学习了
作者: Zap    时间: 2024-6-8 07:31
可以




欢迎光临 无忧启动论坛 (http://bbs.wuyou.net./) Powered by Discuz! X3.3