我正在尝试使用 INNO 编写安装程序脚本,但我陷入了困境,我需要获取运行安装程序的计算机的屏幕分辨率,并使用该值在桌面上创建一个以该分辨率为一的快捷方式的论点。我知道如何创建快捷方式,但是我不知道如何提取屏幕分辨率以及如何传递该信息(可能存储在自定义变量中)以在桌面快捷方式中使用它。
谢谢你的时间 :)
EDIT:我无法更改应用程序,因为我无权这样做。所以请不要建议这样做。
我的解决方案是使用GetSystemMetrics()
,可以在 user32.dll 中找到。这段代码正是我想要的,并且已经在具有双显示器设置的 Windows7 Professional(64 位)上进行了测试。
[Code]
function GetSystemMetrics (nIndex: Integer): Integer;
external '[email protected] stdcall setuponly';
Const
SM_CXSCREEN = 0; // The enum-value for getting the width of the cient area for a full-screen window on the primary display monitor, in pixels.
SM_CYSCREEN = 1; // The enum-value for getting the height of the client area for a full-screen window on the primary display monitor, in pixels.
function InitializeSetup(): Boolean;
var
hDC: Integer;
xres: Integer;
yres: Integer;
begin
xres := GetSystemMetrics(SM_CXSCREEN);
yres := GetSystemMetrics(SM_CYSCREEN); //vertical resolution
MsgBox( 'Current resolution is ' + IntToStr(xres) +
'x' + IntToStr(yres)
, mbInformation, MB_OK );
Result := true;
end;
EDIT:看来索引应该是 SM_CXSCREEN 和 SM_CYSCREEN 。更改了代码以反映这一点。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)