|
-
Mar 11th, 2023, 08:39 AM
#1
Thread Starter
Hyperactive Member
-
Mar 11th, 2023, 08:55 AM
#2
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Do you want your package/app/tool to be exactly X pixels in width on a 4K monitor so the form appears the size of a post-stamp on screen or you want your package/app/tool to be legible on screen but within it all coordinates to remain like no scaling is happening?
Last edited by wqweto; Mar 11th, 2023 at 10:01 AM.
-
Mar 11th, 2023, 11:55 AM
#3
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Not sure if the syntax difference matters but it normally looks like
Code:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<dpiAware>true</dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
-
Mar 11th, 2023, 12:04 PM
#4
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Your app also needs to be themed and the manifest saved as "yourappname.exe.manifest". Here's a working manifest:
Code:
<?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">
<assemblyIdentity type="win32" version="1.00.0.0" processorArchitecture="x86" name="YourAppName"/>
<description>YourAppDescription</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" version="6.0.0.0" processorArchitecture="x86" name="Microsoft.Windows.Common-Controls" language="*" publicKeyToken="6595b64144ccf1df"/>
</dependentAssembly>
</dependency>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Windows Vista -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
</application>
</compatibility>
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
</asmv3:windowsSettings>
</asmv3:application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
You need to compile the manifest into a ".RES" file with ID 24 (using RC.exe and a ".RC" file):
"yourappname.rc" template for compiling the manifest:
Code:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "yourappname.exe.manifest"
Compile the manifest into a resource file with:
Code:
"C:\Program Files (x86)\Microsoft Visual Studio\VB98\Wizards\RC.EXE" /r /fo yourappname.res yourappname.rc
Then add the "yourappname.res" file into your VB project and compile a new executable. You should be all set now!
-
Mar 11th, 2023, 12:11 PM
#5
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Much easier ways to do this...
LaVolpe's Manifest Creator II
-
Mar 11th, 2023, 01:22 PM
#6
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Is it working or is it not working, that's the question.
In other words, why do you say it is not working.
Run this code to check whether it is working or not:
Code:
MsgBox Screen.TwipsPerPixelX
If you run the compiled exe to other than 100%/96 DPI and it reports 15, then the manifest is not working.
-
Mar 11th, 2023, 04:32 PM
#7
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
You can't be DPI Aware simply by marking your compiled program as such. It works where twips/pixel is an integer but fails in cases where it isn't. There are workarounds to do most of the scaling yourself but that can add up to a lot of fiddly code in a program with a complex user interface.
Here you seem to be trying to say "don't scale anything for me automatically" but that fails to take into account other scaling in a VB UI that assumes integral twips/pixel, points/pixel, etc.
-
Mar 11th, 2023, 06:17 PM
#8
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
I assumed he used an embedded manifest.
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Mar 11th, 2023, 09:57 PM
#9
-
Mar 11th, 2023, 11:54 PM
#10
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
You can just include the manifest via the Registry Editor add-in too. No need for RC.exe for this.
-
Mar 12th, 2023, 12:15 AM
#11
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
I think you mean the "Visual Basic 6 Resource Editor" add-in, I don't have any Registry Editor add-in. As far as I can tell the RC.exe tool is adding some binary data to the manifest when compiling it to a ".RES" file. I don't think the add-in can do that and furthermore I think this extra data is also required to make the ".RES" file aligned to a dword boundary... After compiling it then you can add it to your project with the add-in or simply by right-clicking on the project and selecting "Add File".
-
Mar 12th, 2023, 12:22 AM
#12
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Yes, my mistake. I was trying to do two things at once and "registry" got typed in error.
You can do the DWORD padding manually. Just create your file, check the size, then add spaces at the end to a 4-byte boundary.
-
Mar 20th, 2023, 11:48 PM
#13
Thread Starter
Hyperactive Member
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
 Originally Posted by VanGoghGaming
Your app also needs to be themed and the manifest saved as "yourappname.exe.manifest". Here's a working manifest:
Code:
<?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">......</assembly>
You need to compile the manifest into a ".RES" file with ID 24 (using RC.exe and a ".RC" file):
....
You should be all set now!
update: i have added your manifest, but outcome is same (as the attached screenshot in main post)
 Originally Posted by Eduardo-
Is it working or is it not working, that's the question.
In other words, why do you say it is not working.
Run this code to check whether it is working or not:
Code:
MsgBox Screen.TwipsPerPixelX
If you run the compiled exe to other than 100%/96 DPI and it reports 15, then the manifest is not working.
update: on 125% display settings it shows 12
-
Mar 21st, 2023, 12:33 AM
#14
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
 Originally Posted by Shohag_ifas
update: on 125% display settings it shows 12
Then the manifest is working. The problem is then the interpretation of how to handle DPI awareness.
Maybe this can help: DPI, DPI setting, Twips and DPI awareness
-
Mar 21st, 2023, 01:20 AM
#15
Re: VB6 Preventing Display Scalilng (DPI Aware) Not Working
Try testing it at 200%. That's an example of where it all breaks down. It should give 7.5 but you get 7 (wrong) instead.
Being properly DPI aware is a lot of work and a good deal of stuff VB6 relies on truncates scaling to integer values like that.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|