Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - DPI Miscalculation: Controls update @hide+unhide
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

DPI Miscalculation: Controls update @hide+unhide

 Post Reply Post Reply
Author
Message
lsswiss View Drop Down
Groupie
Groupie


Joined: 18 hours 25 minutes ago
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote lsswiss Quote  Post ReplyReply Direct Link To This Post Topic: DPI Miscalculation: Controls update @hide+unhide
    Posted: 14 hours 40 minutes ago at 4:02am
Since you are developing Version 26, here is a real problem in 24.3 and 26 Beta (yes it still exists in Beta, I tested it):

If you run VB6 under a dpiAware-Manifest with the dpi-Setting set to true, then your process should run natively dpi aware.

On 100%, 150%, 200% everything works fine and the controls are well placed.

But if you go with 225% or 175% DPI setting in Windows, then many Codejock Suite controls are not well placed, until you hide them and show them again.

Before hide/unhide the sample looks like this:



Note, how many controls are not within right borders.

After hide and unhide it looks like this, which is right:



The Line that is necessary in the vb6.exe.manifest to see this behaviour, is:
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>

Test it with the SuiteControls sample under the path:
C:\Program Files (x86)\Codejock Software\ActiveX\Xtreme SuitePro ActiveX v24.3.0\Samples\Controls\VB\SuiteControls

Just add the following lines to the example to get the proof how it updates some controls when you set visible first to false and then to true again:

Private Sub Form_Activate()
  
  On Error Resume Next
  
  Dim ctrl As VB.Control
  Dim oldTimer As Single
  
  'Wait 5 seconds to see the before:
  oldTimer = Timer
  Me.Caption = "Go Ahead!"
  Do While Timer < oldTimer + 5
    DoEvents
  Loop
  
  For Each ctrl In Me.Controls
    If TypeName(ctrl) <> "Menu" Then
      Me.Caption = "Now: " & ctrl.Name
      Debug.Print "Now: " & ctrl.Name
      If ctrl.Name = "mnuPopup" Then Stop
      
      ctrl.Visible = False
      ctrl.Visible = True
      
      DoEvents
      
      'Uncomment, if you want to slow it down a bit:
      'oldTimer = Timer
      'Do While Timer < oldTimer + 0.1
      '  DoEvents
      'Loop
    End If
  Next
End Sub

-----

If you want a complete manifest file that you drop to a text file at C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.EXE.manifest, here the manifest that I used, then start VB6 again:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly
  xmlns="urn:schemas-microsoft-com:asm.v1"
  manifestVersion="1.0"
>
  <assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="*"
    name="Visual Basic 6"
    type="win32"
  />
  <description>
    Visual BASIC RAD IDE
  </description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
        type="win32"
        name="Microsoft.Windows.Common-Controls"
        version="6.0.0.0"
        processorArchitecture="*"
        publicKeyToken="6595b64144ccf1df"
        language="*"
      />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
  <security>
   <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
    <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
    </requestedPrivileges>
   </security>
  </trustInfo>
  <asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
    <asmv3:windowsSettings>
      <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
      <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>  

Back to Top
lsswiss View Drop Down
Groupie
Groupie


Joined: 18 hours 25 minutes ago
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote lsswiss Quote  Post ReplyReply Direct Link To This Post Posted: 13 hours 35 minutes ago at 5:07am
I have to update: with a Windows DPI setting of 100%, 150%, 250% or 300% everything works fine with Codejock Suite ActiveX Controls.

The problems appear if the Windows DPI setting has a value of like for example:

- 175%
- 200%
- 225%
Back to Top
lsswiss View Drop Down
Groupie
Groupie


Joined: 18 hours 25 minutes ago
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote lsswiss Quote  Post ReplyReply Direct Link To This Post Posted: 1 hour 55 minutes ago at 4:47pm
After testing this issue more deep, I come to the clue, that it might be even a Windows limitation. I say this because even the VB-internal UserControls have similar issues and are painting with wrong dimensions when DPIawareness is set from outside of the process in the Manifest file, same as here.

The solution for this problem would be to let users know that they have to turn on the DPIAwareness in Visual Basic 6 in-process, not in the manifest file (out-of-process).

That can be done in the VB6 sourcecode by declaring:

Declare Function SetProcessDpiAwareness Lib "shcore.dll" (ByVal Value As Long) As Long
Const DPI_AWARENESS_SYSTEM_AWARE As Long = 1

And by activating the dpiawareness with:

SetProcessDpiAwareness DPI_AWARENESS_SYSTEM_AWARE

There is still a small Bug when using in-process dpiawareness in the Ribbon, which I have posted in:

If Codejock could fix the other bug in V26 ("drop down icons are too small in the Ribbon on high DPI settings"), VB6 users would have a good way to come around the issue above.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.

This page was generated in 0.266 seconds.