View Single Post
Old 6th August 2017, 14:32   #9
Junior Member
Join Date: Jul 2017
Posts: 8
If anybody interested, here is the piece of code I used to show different bitmaps according to the DPI setting

PHP Code:
ManifestDPIAware true

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "Resource\license.rtf"
!insertmacro MUI_PAGE_FINISH

Function .onInit
/oname=$PLUGINSDIR\welcome96.bmp Resource\welcome96.bmp
/oname=$PLUGINSDIR\welcome120.bmp Resource\welcome120.bmp
/oname=$PLUGINSDIR\welcome144.bmp Resource\welcome144.bmp
/oname=$PLUGINSDIR\welcome192.bmp Resource\welcome192.bmp

/oname=$PLUGINSDIR\header96.bmp Resource\header96.bmp
/oname=$PLUGINSDIR\header120.bmp Resource\header120.bmp
/oname=$PLUGINSDIR\header144.bmp Resource\header144.bmp
/oname=$PLUGINSDIR\header192.bmp Resource\header192.bmp

Function showHiDpi
::Call USER32::GetDpiForSystem()i.r0 
${If} $0 U<= 
::Call USER32::GetDC(i0)i.r1 
::Call GDI32::GetDeviceCaps(ir1,i88)i.r0 
::Call USER32::ReleaseDC(i0,ir1

Unless} $== 120
${AndUnless} $== 144
${AndUnless} $== 192
$0 96

NSD_SetImage$mui.WelcomePage.Image $PLUGINSDIR\welcome$0.bmp $mui.WelcomePage.Image.Bitmap
${NSD_SetImage$mui.FinishPage.Image $PLUGINSDIR\welcome$0.bmp $mui.FinishPage.Image.Bitmap
/IMGID=1046 "$PLUGINSDIR\header$0.bmp"
Also, it's important to note that HiDPI bitmaps size is not exactly the standard size multiplied by the scaling factor. Here are the values I used to fit perfectly (at least on Windows 10):

Header bitmap:
96dpi: 150x57
120dpi: 175x70
144dpi: 225x83
192dpi: 300x109

Welcome/Finish bitmap:
96dpi: 164x314
120dpi: 191x386
144dpi: 245x458
192dpi: 327x603
mgrand is offline   Reply With Quote