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.
#include <windows.h> int main(int argc, char* argv[]) { int i; SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &i, 0); SystemParametersInfo(SPI_SETFONTSMOOTHING, !i, 0, 0); Sleep(5000); SystemParametersInfo(SPI_SETFONTSMOOTHING, i, 0, 0); return 0; }