Why you need to actually test instead of just looking at the source code

In a previous post, I mentioned that you need to set the GUID_PROP_COMPOSING property across text in a composition, or else Windows XP will terminate the composition.

That’s true.

I then provided a code snippet to set that property.

That snippet is wrong.

It turns out that you can’t set the GUID_PROP_COMPOSING property via ITfProperty::SetValue.  If you try, you’ll get a TF_E_READONLY error (even if you are in a read-write edit session), which can cause great consternation.

Instead, you need to call ITfComposition::ShiftStart and/or ITfComposition::ShiftEnd to set the bounds of the composition after changing the text in your composition.

These calls update the GUID_PROP_COMPOSING property internally.

Sorry for the confusion.

Skip to main content