Created
May 27, 2014 12:31
-
-
Save 607011/24dd130ef623ffd62d22 to your computer and use it in GitHub Desktop.
Cleartype on/off
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param([bool]$enable) | |
| $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 | |
| if ($enable) | |
| { | |
| [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) | |
| } | |
| else | |
| { | |
| [void]$winapi::SystemParametersInfo($SPI_SETFONTSMOOTHING, 0, 0, $SPIF_UPDATEINIFILE -bor $SPIF_SENDCHANGE) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turn Cleartype on:
Turn Cleartype off: