Results 1 to 8 of 8

Thread: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    [VB6, twinBASIC] System Magnification API Demo (32/64bit)


    System Magnification API Demo

    This is a quick port of the Windows SDK example for the Magnification API.

    There's two versions:

    The original twinBASIC version, made using WinDevLib, so all APIs/UDTs/etc were already defined.

    A backported VB6 version, which uses local copies of the defs. It's still 64bit compatible and can readily be imported to tB and compiled for either 32 or 64 bit.

    At the top of the code you'll find options for the zoom factor (default 2.0) and whether to invert colors (default false).

    NOTE: MSDN documentation says the Magnification API is not supported under WOW64; but at least for the basic functionality in this project, it works without issue in both VB6 and tB 32bit on my 64bit Win10. It's recommended you use the twinBASIC version in 64bit mode for 64bit Windows just in case this isn't true in all versions or you want to expand functionality.


    Download from GitHub

    (The WDL version makes it too big to attach here due to microscopic file size limits)
    Last edited by fafalone; Oct 20th, 2024 at 06:40 AM.

  2. #2
    Fanatic Member
    Join Date
    Jun 2016
    Location
    España
    Posts
    632

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Very good work.
    It works perfectly in Twinbasic.
    In vb6 too but with a minor change.
    change this
    Code:
        WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
        WS_OVERLAPPEDWINDOW = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
    to this
    Code:
        WS_OVERLAPPEDWINDOW = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
        WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW

    Regards

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Sorry, I had made that change but I guess it didn't save. Updated the .bas attached to the VB6 project I'll change the twinprojs and WDL too just for copy/paste compatibility.
    Last edited by fafalone; Oct 20th, 2024 at 06:37 AM.

  4. #4
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Lovely and useful as always. Is your speed of release increasing to match Wayne's?
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Project updated: Wondered why the system magnifier app looked smoother? Turns out it uses undocumented APIs MagSetLensUseBitmapSmoothing or MagSetFullscreenUseBitmapSmoothing Version 1.1 of this project is now out and adds an option to use this feature too.

    Note: Smoothing may not work in the VB6 IDE (but does work in VB6 compiled exes).
    Change useSmoothing to False to run from the VB6 IDE if you're experiencing crashing when it's on. It was crashing every time for me but then mysteriously stopped when I went back an hour later to examine it closer. Works fine in tB IDE.
    Last edited by fafalone; Oct 20th, 2024 at 06:19 PM.

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    7,667

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Quote Originally Posted by yereverluvinuncleber View Post
    Lovely and useful as always. Is your speed of release increasing to match Wayne's?
    Could never match Wayne on that lol

    Still though, getting back closer to normal after I didn't do anything for like 2 months due to a health issue (doing much better now).

  7. #7
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,192

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    Quote Originally Posted by fafalone View Post
    Project updated: Wondered why the system magnifier app looked smoother? Turns out it uses undocumented APIs MagSetLensUseBitmapSmoothing or MagSetFullscreenUseBitmapSmoothing Version 1.1 of this project is now out and adds an option to use this feature too.

    Note: Smoothing may not work in the VB6 IDE (but does work in VB6 compiled exes).
    Change useSmoothing to False to run from the VB6 IDE if you're experiencing crashing when it's on. It was crashing every time for me but then mysteriously stopped when I went back an hour later to examine it closer. Works fine in tB IDE.
    Btw, this stackoverflow answer suggests magnifier API (so called Lens) is using xBR pixel-art upscaling algorithm which is probably in this case implemented on the GPU for speed.

    I doubt it is possibe this to be used to upscale custom DIBs outside of painting it on a hWnd and then capturing the zoomed window which seems cumbersome but instead I just compiled xBRZ spin-off to an DLL (XP compatible) and this does wonders for upscaling app icons/images for high DPI displays.

    Will post a CodeBank entry soon with more details and a working sample how to spruce app's toolbars and images for outstanding results in 150% to 225% DPI scaling.

    cheers,
    </wqw>

  8. #8
    PowerPoster yereverluvinuncleber's Avatar
    Join Date
    Feb 2014
    Location
    Norfolk UK (inbred)
    Posts
    3,560

    Re: [VB6, twinBASIC] System Magnification API Demo (32/64bit)

    I need this for my VB6/RichClient desktop magnifying glass
    https://github.com/yereverluvinunclebert

    Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.

    By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.

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