Skip to content

CalDymos/GenerateManifestResource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PB Manifest Resource Generator (PerMonitorV2)

A small PureBasic tool that generates a Windows RT_MANIFEST resource as:

  • resource.rc
  • manifest.bin

The manifest enables:

  • Per-Monitor DPI Aware v2 (PerMonitorV2) with fallback to PerMonitor
  • optional Modern Theme support (Common-Controls v6)
  • optional requestedExecutionLevel (asInvoker / requireAdministrator)

The output is intended to be embedded into your PureBasic EXE by adding the generated resource.rc to Compiler Options → Resources in the PureBasic IDE.

Why this exists

PureBasic’s built-in DPI option is limited to the IDE’s provided settings. If you need PerMonitorV2 via manifest, this tool generates a proper RT_MANIFEST resource that the PureBasic IDE can compile and link into the executable as part of the normal build.

Output

The tool writes files into a target folder (default: resources/windows/manifest/):

  • resource.rc
    Contains 1 24 "manifest.bin" → Resource ID 1, resource type 24 (RT_MANIFEST)
  • manifest.bin
    The manifest XML payload (ASCII file containing UTF-8 XML header)

Notes: The generator can still run before builds to update output when settings change.

Requirements

  • Windows
  • PureBasic IDE (for easiest automation)
  • PureBasic compiler (ships with the IDE)

Usage

PureBasic IDE

You can run the generator automatically before building your EXE:

  1. Compile the generator once to an EXE (example output): tools\GenerateManifestResource.exe (location is up to you)

  2. In the PureBasic IDE:

    • Tools → Configure Tools…
    • Add a new tool:
      • Command-line: path to GenerateManifestResource.exe
      • Arguments:
        • (optional) <outputDir> to override the default output folder
        • (optional) <dpiMode> to control DPI awareness: pmv2 | system | off
        • Examples:
          • (default output, PerMonitorV2): (leave empty)
          • (default output, System aware): system
          • (custom output, PerMonitorV2): resources\windows\manifest\ pmv2
          • (custom output, System aware): resources\windows\manifest\ system
      • Trigger: Before create Executable
      • Enable Wait until tool quits

Now every build will regenerate the manifest resource before the final executable is created.

Embed into your application

In your application project:

  1. Open Compiler Options
  2. Go to Resources
  3. Add: resources\windows\manifest\resource.rc
  4. Compile your application

Important: avoid duplicate manifests

When embedding a custom RT_MANIFEST via resource.rc (type 24, id 1), PureBasic must not add its own manifest. Otherwise the linker fails with a duplicate MANIFEST resource error.

Disable in Compiler Options:

  • ✅ Enable XP skin support (must be OFF)
  • ✅ Enable DPI Aware Executable (must be OFF)

the generated manifest manifest.bin already contains:

  • Common-Controls v6 (modern theme support)
  • PerMonitorV2 DPI awareness (+ fallback)

Note:
the tool also checks if xpskin="0" and dpiaware="0"

Configuration

Edit constants near the top of GenerateManifestResource.pb:

  • #ENABLE_MODERN_THEME_SUPPORT
  • #DEFAULT_DPI_MODE$ (default DPI-Mode)
  • #REQUEST_EXECUTION_LEVEL$ ("asInvoker", "requireAdministrator", or empty to omit)
  • #OUT_REL_DIR$ (repo-relative output directory)

DPI configuration emitted (PerMonitorV2)

The generated manifest includes:

  • <dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness> or <dpiAwareness>System</dpiAwareness>
  • <dpiAware>true/pm</dpiAware> as fallback for older systems

About

PureBasic tool that generates and embeds a Windows RT_MANIFEST resource (Resource.rc + Data_1.bin) with Per-Monitor DPI Aware v2 support. Designed for PureBasic IDE workflows: run via External Tools trigger before build, then include the generated .rc in Compiler Options → Resources.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors