Skip to content

Instantly share code, notes, and snippets.

@technoscavenger
Created December 4, 2019 01:37
Show Gist options
  • Save technoscavenger/407c0683aa794316a174eb6d433fa289 to your computer and use it in GitHub Desktop.
Save technoscavenger/407c0683aa794316a174eb6d433fa289 to your computer and use it in GitHub Desktop.
Enable ClearType using PowerShell
$signature = @'
[DllImport("user32.dll")]
public static extern bool SystemParametersInfo(
uint uiAction,
uint uiParam,
uint pvParam,
uint fWinIni);
'@
$SPI_SETFONTSMOOTHING = 0x004B
$SPI_SETFONTSMOOTHINGTYPE = 0x200B
$SPIF_UPDATEINIFILE = 0x1
$SPIF_SENDCHANGE = 0x2
$FE_FONTSMOOTHINGCLEARTYPE = 0x2
$winapi = Add-Type -MemberDefinition $signature -Name WinAPI -PassThru
[void]$winapi::SystemParametersInfo($SPI_SETFONTSMOOTHING, 1, 0, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE)
[void]$winapi::SystemParametersInfo($SPI_SETFONTSMOOTHINGTYPE, 0, $FE_FONTSMOOTHINGCLEARTYPE, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment