Setting the DPI Awareness

Visual Basic User's Guide > A Word Processor

TX Text Control supports system DPI aware applications. DPI aware applications detect the system DPI to scale accordingly. The recommended way of specifying the default process DPI awareness is through an application manifest setting. This manifest needs to be embedded into the application executable as an application resource.

The following sample shows the manifest file to configure the DPI awareness (you will find this XML file in the samples folder):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
    </windowsSettings>
  </application>
</assembly>

In order to embed the manifest file into the executable, the tool Mt.exe needs to be utilized. This tool is available in the Microsoft Windows Software Development Kit (SDK). The default installation path for the Windows SDK is \Program Files\Windows Kits\10 on 32bit systems and \Program Files (x86)\Windows Kits\10 on 64bit systems. Applications created with Visual Basic 6 are 32bit applications, but you can use either the 32bit or 64bit version of Mt.exe.

Open a Developer Command Prompt (or define the environment variables manually), and use the following command to embed the manifest file:

In case, your executable already contains a manifest resource, use the following command to update the resource:

mt -manifest dpiaware.manifest -updateresource:txwords.exe

If your executable doesn't contain a manifest resource, use the following command to embed a new manifest:

mt -manifest dpiaware.manifest -outputresource:txwords.exe