A small PureBasic tool that generates a Windows RT_MANIFEST resource as:
resource.rcmanifest.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.
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.
The tool writes files into a target folder (default: resources/windows/manifest/):
resource.rc
Contains1 24 "manifest.bin"→ Resource ID1, resource type24(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.
- Windows
- PureBasic IDE (for easiest automation)
- PureBasic compiler (ships with the IDE)
You can run the generator automatically before building your EXE:
-
Compile the generator once to an EXE (example output):
tools\GenerateManifestResource.exe(location is up to you) -
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
- (optional)
- Trigger: Before create Executable
- Enable Wait until tool quits
- Command-line: path to
Now every build will regenerate the manifest resource before the final executable is created.
In your application project:
- Open Compiler Options
- Go to Resources
- Add:
resources\windows\manifest\resource.rc - Compile your application
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"
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)
The generated manifest includes:
<dpiAwareness>PerMonitorV2, PerMonitor</dpiAwareness>or<dpiAwareness>System</dpiAwareness><dpiAware>true/pm</dpiAware>as fallback for older systems