stdware / qwindowkit

Cross-platform frameless window framework for Qt. Support Windows, macOS, Linux.
Apache License 2.0
490 stars 78 forks source link

在win7 x64和x86上提示“无法定位程序输入点GetSystemMetricsForDpi ” #61

Closed zhoujun637 closed 5 months ago

zhoujun637 commented 5 months ago

经排查,发现代码中使用到GetSystemMetricsForDpi函数,但是这个函数最低支持Windows 10, version 1607。涉及到该函数的代码 qwkwindowsextra_p.h

static inline quint32 getSystemMetricsForDpi(int index, quint32 dpi) {
        const DynamicApis &apis = DynamicApis::instance();
        if (apis.pGetSystemMetricsForDpi) {
            return ::GetSystemMetricsForDpi(index, dpi);
        }
        return ::GetSystemMetrics(index);
}

将上述代码改为:

static inline quint32 getSystemMetricsForDpi(int index, quint32 dpi) {
        const DynamicApis &apis = DynamicApis::instance();
        if (apis.pGetSystemMetricsForDpi) {
            return apis.pGetSystemMetricsForDpi(index, dpi);
        }
        return ::GetSystemMetrics(index);
 }

重新编译后,可解决问题,但是不知道会不会引起其他问题

SineStriker commented 5 months ago

ok,我改改

SineStriker commented 5 months ago

OK了,请拉取最新

zhoujun637 commented 5 months ago

好的,非常感谢