Results 1 to 3 of 3

Thread: n = WinSetProcessDPIAware()

  1. #1
    Senior Member catventure's Avatar
    Join Date
    Oct 2005
    Location
    UK
    Posts
    637
    Rep Power
    83

    n = WinSetProcessDPIAware()

    I saw that in the latest version of thinbasic there is a new function


    n = WinSetProcessDPIAware()


    My TAB adventure program was made using thinbasic core 1.9.16.17. for backwards compatibility with Windows XP and above.


    A user of my program tested on his system and reported that even on a low end laptop with win 10 and a full HD screen (1920 x 1080) there were readability problems due to display size of the TAB app.


    The text in the editor where you type the info for location text is literally unreadable it is so small. And the game text in the runner is literally unreadable and too small.


    TAB seems very fast and the editor looks awesome, for what I can see. Unfortunately the text aspect of TAB is not compatible with modern systems. A shame, because otherwise TAB appears awesome in reading through the features.


    it is difficult trying to find something that still works and that works with modern systems and is DPI aware and will display properly on modern systems."

    Since I cannot use the new DPI function available in the new thinbasic version, what equivalent code would I need to include to update my program so that it will be dpi (dots per inch) aware and automatically adjust to the screen resolutions and monitor displays of the more modern high end setups of today?


    It would be great if in fact possible to do? How would I achieve it - and whereabouts would I position the code in my program listing?
    (I'm assuming it would need to be set as a default before the program creates any Windows)


    I am only a hobbiest programmer and after reading the microsoft link in the thinbasic help file for the new function I do not understand or see how I would begin to implement it correctly into my code.


    MS documentation at:
    https://learn.microsoft.com/en-us/wi...rocessdpiaware



    I would really like it if my program could be usable on as many Windows rez as possible. Seems later setups have changed gradually over the years to higher settings than the default standard 96dpi


    Regards,
    catventure/Philip.
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10
    Ciao,

    you can try the following call that tells the operating system that your application is not dpi aware

    https://learn.microsoft.com/en-us/wi...ssdpiawareness

    'Declare Function SetProcessDPIAware Lib "user32.dll" Alias "SetProcessDPIAware" () As Long
    %PROCESS_DPI_UNAWARE = 0
    %PROCESS_SYSTEM_DPI_AWARE = 1
    %PROCESS_PER_MONITOR_DPI_AWARE = 2
    Declare Function SetProcessDpiAwareness Lib "Shcore.dll" Alias "SetProcessDpiAwareness" (byval PROCESS_DPI_AWARENESS  as dword) As Long
    SetProcessDpiAwareness(%PROCESS_DPI_UNAWARE)
    
    If it works, you can add a parameter to your application to call or not this function depending on some circumstances.

    Let me know
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    Senior Member catventure's Avatar
    Join Date
    Oct 2005
    Location
    UK
    Posts
    637
    Rep Power
    83
    Hi Eros,


    Thank you for your response.


    I placed this code into my program listing near the top and my program ran as normal.


    %PROCESS_DPI_UNAWARE = 0
    %PROCESS_SYSTEM_DPI_AWARE = 1
    %PROCESS_PER_MONITOR_DPI_AWARE = 2
    Declare Function SetProcessDPIAware Lib "user32.dll" Alias "SetProcessDPIAware" () As Long
    


    The other bit of code you supplied did not


    %PROCESS_DPI_UNAWARE = 0
    %PROCESS_SYSTEM_DPI_AWARE = 1
    %PROCESS_PER_MONITOR_DPI_AWARE = 2
    Declare Function SetProcessDpiAwareness Lib "Shcore.dll" Alias "SetProcessDpiAwareness" (byval PROCESS_DPI_AWARENESS  as dword) As Long
    SetProcessDpiAwareness(%PROCESS_DPI_UNAWARE)
    

    (Invalid. Didn't recognise Lib "Shcore.dll)


    I understand that If the dpi setting is >96 then no doubt it will be required to make the TAB program dpi aware.


    This could mean devising code to take into account the different versions of windows that might be running the program....?


    I also accept that some GUI elements and fonts might need to be scaled somehow - so might need to get the current desktop dpi ratios from the monitor...


    Sounds though like it might be a little complicated - but maybe possible to implement this.

    How and what code do I need to do it? Any help suggestions would be great.


    If TAB is not dpi aware then Windows will probably scale it resulting in smaller gui, images and text.


    When I created my program all those years ago I did not envisage this problem of visibility or usability occurring on the high end monitor resolutions which are slowly becoming default on newer setups nowadays.




    Thanks ever so much,
    catventure/Philip.
    http://tab.thinbasic.com - Home Of The ThinBasic Adventure Builder Project. (Interactive Fiction/Text Adventure Maker)

Members who have read this thread: 1

Posting Permissions

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