下面的代码怎么修改和调用不报错?
procedure TFrmBase.SetDpiSize;
var
setProcessDPIAwareness: Pointer;
setting, WinDPI: Integer;
begin
// Set DPI Awareness depending on a registry setting
with TRegIniFile.create('SOFTWARE\' + SRegName) do
begin
setting := readInteger('SETTINGS', 'scale', 0);
Free;
end;
handle := LoadLibrary('shcore.dll');
if handle <> 0 then
begin
setProcessDPIAwareness := GetProcAddress(handle, 'SetProcessDpiAwareness');
if Assigned(setProcessDPIAwareness) then
begin
if setting < 2 then
// setting <2 means no scaling vs Windows
setProcessDPIAwareness(0)
else
// setting 2: 120%, 3: 140% vs. Windows
// The actual used scaling factor multiplies by windows DPI/96
setProcessDPIAwareness(1);
end;
FreeLibrary(handle);
// Get windows scaling as Screen.PixelsPerInch was read before swiching DPI awareness
// Our scaling routines now work with WinDPI instead of Screen.PixelsPerInch
WinDPI := Screen.MonitorFromWindow(application.handle).PixelsPerInch;
end;
end; 如果把代码全部删掉了不就不报错了,我真是太机智了 李佑辰 发表于 2022-3-22 01:20
如果把代码全部删掉了不就不报错了,我真是太机智了
我反手举报版主姥爷来抓你,我ttm机智了。{:301_1000:}
页:
[1]