View Single Post
Old 24th June 2022, 13:16   #49
rgreen
Junior Member
 
Join Date: Jun 2022
Posts: 29
No reason. The install mirrors the tree structure of a website containing any number of folders, but the installer can go anywhere.

'bin' is merely a habit.

===

There are a few more quirks in Windows at different DPI settings.

I found `System::Call 'SHCORE::GetProcessDpiAwareness(p0,*i0r1)'` useful in setting the dpi-awareness only for standard sizes. 120, 144, 168, 192.

168 dpi is as bad as 120 dpi when it comes to the application window size. It is more narrow than at 96 dpi.

No one can say what future Windows versions will bring, but because 168 and 120 dpi alter the aspect-ratio by a lot, the developers might decide to streamline all DPI sizes, so there is a nice gradient when you switch to a higher or lower monitor setting. For designers this would mean adapting.

All things considered, "ManifestDPIAware false" is the safest choice, letting Windows re-scale everything up from 96 dpi. I had wondered about using "ManifestDPIAware true" in the past. It seemed like a fair choice, but having investigated it, the "false" setting, as I now think, has a lot going for it.

To switch dpi-aware on and off, I used a variable '$DPI_SCALE'. The default 96 dpi image is 's.bmp' or 'sUN.bmp' (uninstaller).

MACRO
PHP Code:
!macro DPIX UN
  StrCpy $DPI_SCALE 
"DWM" # ; user variable
  
System::Call 'SHCORE::GetProcessDpiAwareness(p0,*i0r1)'
  
${IfThen} $${|} StrCpy $1 PROCESS_SYSTEM_DPI_AWARE ${|}
  
System::Call 'USER32::GetDpiForSystem()i.r2'
  
System::Call 'USER32::IsProcessDPIAware()i.r3'
  
example 6002get=0 sysdpi=error aware=(Vista)
  
#MessageBox MB_OK "${TEMP1}: get=$1 sysdpi=$2 aware=$3"
    
StrCpy $SYS_DPI $#
    
StrCpy $DPI_AWARE $#

  
${If} $== "PROCESS_SYSTEM_DPI_AWARE" process okay
  
${AndIf} $== aware
    
${If} $== 192
    
${OrIf} $== 168
    
${OrIf} $== 144
    
${OrIf} $== 120
        StrCpy $DPI_SCALE 
"" #
      
${If} $== 192
        File 
"/oname=$PluginsDir\modern-header.bmp" "xl${UN}.bmp" 192
      
${ElseIf} $== 168
        File 
"/oname=$PluginsDir\modern-header.bmp" "l${UN}.bmp" 168
      
${ElseIf} $== 144
        File 
"/oname=$PluginsDir\modern-header.bmp" "m${UN}.bmp" 144
      
${ElseIf} $== 120
        File 
"/oname=$PluginsDir\modern-header.bmp" "n${UN}.bmp" 120
      
${EndIf}
      ${
IfNot$DPI_SCALE == "DWM"
        
!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
          
MUI_LOADANDXALIGNIMAGE "NoStretchNoCrop"
      
${EndIf}
    ${EndIf}
  ${EndIf}
!
macroend 
INSTALLER
PHP Code:
Function .onInit
  
DPI-aware on-switch provided ManifestDPIAware is "notset"
  
GetWinVer ${TEMP1Build
  IntCmp 
${TEMP110240 0 jump 0 ; require Windows 10
  
dpi font-scaling was eratic on earlier Windows
  System
::Call 'USER32::SetProcessDPIAware()i.r0'
  
jump:
  ...
FunctionEnd

Function onGUIInit_func
  
Re-scaled bitmaps
  
!insertmacro DPIX ""
  
...
FunctionEnd 
UNINSTALLER
PHP Code:
Function un.onInit
  GetWinVer 
${TEMP1Build
  IntCmp 
${TEMP110240 0 jump 0 Windows 10+
  
System::Call 'USER32::SetProcessDPIAware()i.r0'
  
jump:
  ...
FunctionEnd

Function un.onGUIInit_func
  
Re-scaled bitmaps
  
!insertmacro DPIX "UN"
  
...
FunctionEnd 
May it help someone.
rgreen is offline   Reply With Quote