Results 1 to 10 of 10

Thread: [RESOLVED] DPI Aware question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Posts
    145

    Resolved [RESOLVED] DPI Aware question

    LaVolpe - great explanation in your Tutorial on DPI Awareness! thank you for your work.

    In your discussion on VB's Screen object in post #3, when VB is run in virtual DPI, if we test...
    Code:
    Code:
    If ScreenWidth(False) <> ScreenWidth(True) Then MsgBox "Virtualized DPI"
    Does this 'always' mean that the windows is virtualizing? (are there cases when this is NOT true)?

    Also, does win7 and win10 behave the same in this respect?
    Last edited by Jimboat; Sep 18th, 2020 at 10:19 AM.
    /Jimboat

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DPI Aware question

    Those can't really determine if you're app is virtualized, only if the system DPI is same as what VB's internal DPI is. In most cases when DPI > 150%, system DPI is not same as VB's internal DPI when app is system-aware.

    If app is system-aware it is not virtualized if launched into system DPI, whether those comparisons are equal or not. However, let's say app is system-aware and launched into DPI 100%,125%,150% then VB's internal DPI matches system DPI and if those comparisons are not equal, then virtualization is in play. But at 175% DPI, those comparisons won't be equal whether virtualization applies or not.

    If app is not manifested, it is virtualized if those comparisons are not equal

    Do note that that other thread did not discuss per-monitor awareness since it was not a serious discussion in the VB community at the time. I think that thread is well overdue for updating.

    Edited: Prior to Win8.1, per-monitor awareness didn't exist. Apps were either unaware or system aware only.
    Last edited by LaVolpe; Sep 18th, 2020 at 10:57 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Posts
    145

    Re: DPI Aware question

    Quote Originally Posted by LaVolpe View Post
    If app is not manifested, it is virtualized if those comparisons are not equal
    Ok. thanks. That was really my question. if NOT manifested, then those comparisons <> will confirm app is virtualized with all OS's and all DPI's > 96?
    /Jimboat

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DPI Aware question

    Quote Originally Posted by Jimboat View Post
    Ok. thanks. That was really my question. if NOT manifested, then those comparisons <> will confirm app is virtualized with all OS's and all DPI's > 96?
    Except XP. It didn't have manifests for awareness, system settings only.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: DPI Aware question

    FYI: DPI virtualization on modern systems is not static. An app can move into and out of virtualization as DPI changes.

    Oh, regarding unmanifested apps. There is one gotcha & possibly another.

    1. If dragging the app to another monitor not having 96 DPI, that comparison won't work because it is based on the primary monitor's DPI. In that case, need to check the DPI on the monitor the app is currently dragged to. There are APIs to determine which monitor your app is on and to get the DPI for that monitor (if scenario applies)

    2. I don't have a monitor that rotates 90 degrees. So, I don't know what results would be returned in that case.

    Edited. Typically, an app does not need to know if it is currently DPI-virtualized or not.
    Last edited by LaVolpe; Sep 18th, 2020 at 11:50 AM.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Posts
    145

    Re: DPI Aware question

    LaVolpe - thanks again for your learned help!
    /Jimboat

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Posts
    145

    Re: DPI Aware question

    So, with Win7, when does OS use virtualization? Testing a non-manifested exe, from my tests with Win7, it seems that XP style scaling (TPP changes with change in DPI setting) is always working, and i don't see a condition where virtualization is triggered? The compatibility settings (use XP style scaling) don't seem to make any difference. it's non-virtualization in all cases (125%, 150%, 200%).
    /Jimboat

  8. #8
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] DPI Aware question

    Here are some notes I have
    ...
    2) Vista/Win7. There are two scaling modes used that apply to all applications except DPI-aware ones

    a) XP-Style scaling. This is a system-wide setting and disables DPI virtualization. No longer available as of Win8. After Win7, your only option is virtualization if the app is not declared DPI-aware.

    b) DPI Virtualization. This is probably the worst option and applies to applications that are not DPI-aware. What happens is that your application runs under a 96 DPI environment, regardless of real DPI setting. Anything that is displayed on screen is rendered to an off-screen bitmap and stretched to the DPI scale. For an easy visualization, screen capture your app into MS Paint. Now stretch that image by 125% to 200%. That is exactly what your app will look like in DPI virtualization if it is not declared as DPI-aware or DPI vritualization is not disabled.
    If your system has that option set, then that would explain what you are seeing. That setting can be seen on the screenshot from this site; jump to Figure D and you'll see the checkbox to enable XP-style scaling. Sorry, I don't have Win7 to play along.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Feb 2004
    Posts
    145

    Re: [RESOLVED] DPI Aware question

    Quote Originally Posted by LaVolpe View Post
    Here are some notes I have...
    If your system has that option set, then that would explain what you are seeing. That setting can be seen on the screenshot from this site; jump to Figure D and you'll see the checkbox to enable XP-style scaling. Sorry, I don't have Win7 to play along.
    LaVolpe - good notes on that link. It seems that IF Basic Windows theme is selected, then the "Use XP style scaling" checkbox is greyed out and defaulted (checked) for 100% and 125% scaling, and is greyed out defaulted (unchecked) for anything higher than 125% scaling. If using an Aero Theme, the "Use XP style scaling" checkbox is no longer greyed out, and I can select checked/not checked. Unfortunately, it seems that any combination of Basic/Aero themes and "Use XP style scaling" checked OR not-checked, results in the same condition = no virtualization. Weird. I don't know how to view any virtualization in Win7.
    Attached Images Attached Images  
    /Jimboat

  10. #10
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [RESOLVED] DPI Aware question

    Quote Originally Posted by Jimboat View Post
    ...Weird. I don't know how to view any virtualization in Win7.
    Maybe try this? Add a manifest and in the <dpiAware> element, make the value: false. Idea is that by including a manifest and saying it is not dpi-aware, then maybe your Win7 system will honor that?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width