The Win32 API contains a method called SystemParametersInfo, it is used to get and set system-wide parameters. In this case we will be using it to to get and set system-wide font smoothing. In the following piece of code, font smoothing is toggled and restored after 5 seconds.
01 | #include <windows.h> |
02 |
03 | int main( int argc, char * argv[]) |
04 | { |
05 | int i; |
06 | SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &i, 0); |
07 | SystemParametersInfo(SPI_SETFONTSMOOTHING, !i, 0, 0); |
08 | Sleep(5000); |
09 | SystemParametersInfo(SPI_SETFONTSMOOTHING, i, 0, 0); |
10 | return 0; |
11 | } |