Skip Navigation LinksBCGSoft > Support > Developer Area > Per monitor DPI awareness

Per monitor DPI awareness

Specify Per-Monitor (V2) DPI Awareness in your project:

  1. Create a new XML file in your project folder. You can copy this file from one of our examples/samples. The content of the XML file is (MyApp is your application name):
    
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    <assembly 
       xmlns="urn:schemas-microsoft-com:asm.v1" 
       xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"
       manifestVersion="1.0">
    <assemblyIdentity 
        version="5.1.0.0"
        type="win32"
        name="MyApp.exe"/>
        <description>MyApp Application</description>
        <dependency>
        <dependentAssembly>
        <assemblyIdentity
             type="win32"
             name="Microsoft.Windows.Common-Controls"
             version="6.0.0.0"
             publicKeyToken="6595b64144ccf1df"
             language="*"
             processorArchitecture="*"/>
        </dependentAssembly>
        </dependency>
      <asmv3:application>
        <asmv3:windowsSettings>
          <dpiAware 
              xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
              true/PM
          </dpiAware>
          <dpiAwareness 
              xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
              PerMonitorV2, PerMonitor
          </dpiAwareness>
        </asmv3:windowsSettings>
      </asmv3:application>
    </assembly>
    
  2. Open Project Settings, switch to Manifest Tools | Input and Output and make the following changes:
    • In Additional Manifest File enter path to your XML file created in (1).
    • Set DPI Awareness to None
  3. Add the following initializations in your application InitInstance source code (add them after call to CBCGPWinApp::InitInstance):
    globalData.m_bIsDlgWsCaptionStyle = TRUE;
    globalData.m_bIsMiniFrameWsCaptionStyle = TRUE;

Updating existing application source code:

  1. Replace globalData.font*** with globalUtils.GetFont***(pWnd).
  2. globalUtils.ScaleByDPI has a new optional parameter "current window". Please pass a pointer to the currently used window to this method.
  3. CBCGPToolBar::SetSizes and CBCGPToolBar::SetMenuSizes should receive original (non-scaled) sizes.
  4. If your window class has any DPI-specific resources, please reload them in WM_DPICHANGED or WM_DPICHANGED_AFTERPARENT message handler(s).
  5. If you have a custom (CBCGPProp-derived) property with DPI-specific resources, please override OnDPIChanged method and reload these resources.
  6. If you added icons to CBCGPOutlookBarPane, please reload them in WM_DPICHANGED message handler (see BCGPGridExample application).
  7. If you are calling any CBCGPVisualManager methods in your WM_PAINT message handler, we recommend to use CBCGPPaintDC instead of CPaintDC.
  8. Pass pointer to current window to CBCGPInfoBoxRenderer constructor.
  9. If you have a custom, CBCGPCaptionButton-derived caption button class, please pass a pointer to the parent windows to CBCGPCaptionButton constructor.

Back to the Developer Area