Monday, November 24, 2008

Sending WM_WININICHANGE message on device with HTC TouchFlo 3D will crash the device

Today I finally solved a very strange bug in a Windows Mobile project Im currently working on. The bug would only show up on HTC devices, and not our HTC devices we had at our location. After the application was installed and the user started it, the whole device would freeze and reboot itself after a minute or so.

After some digging around, rebuilding, re-installing for way too many times; we found out that if the HTC TouchFlo 3D today plugin was enabled the device would crash. With that knowledge I was able to pin point the location of the failure which was that the installation DLL sends a
WM_WININICHANGE message to refresh the PocketPc Today plugins.

As many
sites and forum posts states, this is the only way to refresh the Today plugins.

::SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);

Of course, this is not documented anywhere within MS documentation; and the
documentation that exists states that the wParam isnt used at all (which in fact it is).

It seems that the HTC TouchFlo 3D isnt capable of handling the
WM_WININICHANGE properly, and even just opening the calendar application after that sending that message will crash the device. So if your WindowsMobile application sends that message, I would advise you to look into this. Using the replacement message WM_SETTINGCHANGE does not change anything, the device will still crash.


One solution is to check if the HTC TouchFlo Today plugin is enabled, which can easily be retrived through the regkey
"HKLM\Software\Microsoft\Today\Items\TouchFLO 3D\Enabled". If it is enabled, then do not send the WM_WININICHANGE message.