为什么我的消息框看起来与Windows 10否则显示的消息框不同?

时间:2018-09-12 10:04:39

标签: windows windows-10 messagebox user-experience

我在考虑一致性。我在由Visual Studio 2017构建的Windows子系统C / C ++应用程序中使用MessageBox Windows API函数,如下所示:

MessageBox(NULL, "Error opening log file for writing, aborting.", NULL, MB_ICONERROR);

这让我:

My message box

例如当Windows显示的消息框尝试使用“开始”菜单中的“运行”对话框运行无效程序,如下所示:

System message box

这显然不是一个秀场终结者,但是我很好奇,并且在经历了所有版本之后,对于Windows中这种缺乏一致性的水平感到惊讶。是的,我知道有一个向后兼容的棘手问题,他们必须不断解决,但仍然要解决。

这与清单文件中未指定的某些设置,我未明确要求的一些常见控件样式有关吗?除了将DPI Awareness指定为“每个监视器DPI感知”之外,我的项目和解决方案设置均未更改。关闭后者仍会显示相同的消息框(尽管文本模糊,因为如所记录的那样,系统会缩放渲染的位图)。

VS嵌入到内置程序中的清单

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
        <security>
            <requestedPrivileges>
                <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
            </requestedPrivileges>
        </security>
    </trustInfo>
    <asmv3:application>
        <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
            <dpiAware>true</dpiAware>
            <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
        </asmv3:windowsSettings>
    </asmv3:application>
</assembly>

1 个答案:

答案 0 :(得分:-1)

您可以使用VBScript(.vbs)创建一个消息框。写下:

Option Explicit

Dim x

x = MsgBox("Error opening log file for writing. Aborting", VbOkOnly+VbCritical, "Error")