C++: System-Wide Font Smoothing

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);
	SystemParametersInfo(SPI_SETFONTSMOOTHING, i, 0, 0);
	return 0;

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.