-
Jun 21st, 2019, 12:03 PM
#1
Thread Starter
Hyperactive Member
What is this screen resolution / setting?
Hello!
I'm dealing with a computer on which VB6 application looks weird in aspect of scaling and image sizes.
The graphics settings reveal
Resolution: 2560 x 1600
DPI scalling: 200%
I have tried to compensate for that using a manifest that states dpiaware true, but that wouldn't help. A manifest stating dpiaware false also wouldn't help.
Without going too much into detail for now, I would like to ask if there's a simple solution. I thought the manifest would be such a simple solution, but obviously, it didn't help.
Thank you very much for the help.
-
Jun 21st, 2019, 12:17 PM
#2
Re: What is this screen resolution / setting?
If you mark the application DPI Aware it must be aware to do more good than harm.
Your easiest option would be to mark it for GDI Scaling but that requires a recent version of Windows 10. You can do that via the EXE's Properties by choosing "System (Enhanced)" scaling appcompat.
The MSDN Blog post on this seems to be gone now, since it was an old issue everyone is expected to understand at this late date. Support for it came out back in 2017.
-
Jun 21st, 2019, 12:20 PM
#3
Re: What is this screen resolution / setting?
The manifest should help a lot, but it also depends on how you are sizing things. If you are using hardcoded twips values like 15, or using hardcoded pixel offsets, then a you need to rework your code if using a manifest. It's also important to set your manifest values correctly. Incorrect values won't help.
Without a manifest, the application should look stretched. With a proper manifest and not hardcoding twip/pixel values in any code where you move/size controls, then your app should look a lot better.
More details probably needed. A screenshot of before/after using a manifest would be helpful too.
P.S. 200% DPI breaks VB's DPI awareness, but not severely. As does any DPI where this calculation returns a fraction:
Code:
realTwips = 1440 / ((96 * DPIpct) / 100)
' DPIpct are values like 100, 175, 200, etc
-
Jun 21st, 2019, 12:23 PM
#4
Fanatic Member
Re: What is this screen resolution / setting?
Adding a manifest doesn't magically fix the problem, you have to do something extra. See this thread:
[VB6] Tutorial: Being DPI Aware
http://www.vbforums.com/showthread.php?816615
-
Jun 21st, 2019, 12:24 PM
#5
Thread Starter
Hyperactive Member
Re: What is this screen resolution / setting?
Thank you all for the great help and lots of additional information as well!
-
Jun 21st, 2019, 12:27 PM
#6
Re: What is this screen resolution / setting?
GDI Scaling can also be selected by manifest, here is an example showing the required entries:
Code:
<?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 name="WhizBang.Enterprises.Super.App" processorArchitecture="X86" type="win32" version="3.5.0.1777" />
<dependency>
<dependentAssembly>
<assemblyIdentity language="*" name="Microsoft.Windows.Common-Controls" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" type="win32" version="6.0.0.0" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application xmlns="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">
<gdiScaling>True</gdiScaling>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- WinVista --><supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
<!-- Win7 --><supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
<!-- Win8 --><supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Win8.1 --><supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Win10 --><supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
</application>
</compatibility>
</assembly>
That manifest has entries for downlevel OS compatibility as well, but the GDI Scaling entry will be ignored there. This fixes a lot of issues but it may still result in distortion for DIB-based graphics.
-
Jun 21st, 2019, 01:05 PM
#7
Thread Starter
Hyperactive Member
Re: What is this screen resolution / setting?
The crazy thing is:
I had a manifest stating dpiaware = true.
I changed that to dpiaware = false.
Nothing changed.
Then I removed the dpiaware section from the manifest entirely, and my app worked again (stretchy, but nice layout).
-
Jun 21st, 2019, 08:36 PM
#8
Re: What is this screen resolution / setting?
After parsing into the binary form manifests get cached to save time on subsequent runs.
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
|