2
votes

For our Windows Mobile application I want to enable the ClearType option on the device. According to this article on MSDN it should be done be setting the following registry key:

HKEY_LOCAL_MACHINE\SYSTEM\GDI\Cleartype

But nothing happens after setting this particular key. Even a soft reset does not enable it, but simply gets rid of the registry key I just created.

Strange thing is that when I set it manually using Settings->System->Screen->ClearType it works immediately. And comparing the registry exports before and after changing the setting show that it is just the key mentioned above that changes.

I don't quite understand why it wouldn't work when I change the registry key myself. Anyone who knows what I'm doing wrong here?

[update] It looks like the solution is to do either:

  • Broadcast a WM_SETTINGCHANGE message with the correct parameters like:

    SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 1)

    But that has not worked so far. I guess the wParam parameter might need a different value.

  • Or call CreateEvent with the relevant event for ClearType changes. A bit like BacklightChangeEvent or SDKBacklightChangeEvent would work. But so far I haven't seen any documentation on these events, so I can't work out what the event would be.

2
The link you provided refers to Windows CE only. Specifically, it is designated to the person building the image, integrating ClearType into the image. - Shaihi
True, but this did lead me to the required registry key, and when monitoring it while making the change myself, I did see it change in the registry. - Tom van Enckevort
Yes, but apparently the control panel involves another call to GWES to let it know of the change (as you said). Nothing monitors the key change for that specific key, so it seems. I guess I'm not adding any new information with this comment :) - Shaihi

2 Answers

6
votes

I have found the solution myself. It turns out that making the registry change is not needed, but just a call to SystemParametersInfo with the SPI_SETFONTSMOOTHING parameter is enough to make it apply the changes.

This is my code using .NET CF 2.0:

[DllImport("coredll.dll", SetLastError = true)]
static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni);

const uint SPI_SETFONTSMOOTHING = 0x004b;
const uint SPI_UPDATEINI = 0x1;

int pv = 0;
bool ret = SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, ref pv, SPIF_UPDATEINIFILE);
0
votes

Did you flush the registry after changing the value and before doing the Soft Reset?
Sounds like the change did not persist.