View Single Post
Old 31st July 2017, 16:52   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,946
PHP Code:
!include LogicLib.nsh
System
::Call USER32::GetDpiForSystem()i.r0
${If} $0 U<= 0
    System
::Call USER32::GetDC(i0)i.r1
    System
::Call GDI32::GetDeviceCaps(ir1,i88)i.r0
    System
::Call USER32::ReleaseDC(i0,ir1)
${EndIf}
MessageBox mb_ok SysDpi=$
and extract with a size based on https://msdn.microsoft.com/en-us/lib...px#CLOSEST_FIT
Quote:
int iSourceImageDPIToUse = 96; // We will assume 96 by default.

if (gDPI > 144)
iSourceImageDPIToUse = 192;
else if (gDPI > 120)
iSourceImageDPIToUse = 144;
else if (gDPI > 96)
iSourceImageDPIToUse = 120;

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote