“The most important choice in writing is not what you say. It’s what you don’t say.” Eric Gunnerson gave me that advice when I was writing my book. It’s sort of the writing version of “You don’t know what you do until you know what you don’t do.”
That’s why I’ll write
Of course, you probably wonder this magical
pflcomes from. It comes from the Multilanguage Object in mlang.IMLangFontLink2 *pfl; CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMLangFontLink2, (void**)&pfl); ... pfl->Release();
and not
The
pflvariable we’ve been using is an interface pointer to theIMLangFontLink2interface. We obtain this pointer by calling theCoCreateInstancefunction, asking for the object whose class ID isCLSID_CMultiLanguage(defined in themlang.hheader file) and specifying the interface ID (IID) ofIID_IMLangFontLink2. The interface ID is a 128-bit value that uniquely identifies an interface; we use it here to specify that we wish to have access to theIMLangFontLink2interface. Since COM uses explicit reference counting, we must remember to call theIUnknown::Releasemethod when we are finished with the interface pointer. Each call to theIUnknown::Releasemethod decrements the reference count by one, and when the reference count drops to zero, the object is destroyed.IMLangFontLink2 *pfl; CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_ALL, IID_IMLangFontLink2, (void**)&pfl); ... pfl->Release();
This is why I hate reading technical books. People think it’s better to write fifty words when ten are enough, that you should explain everything in excruciatingly tedious detail just in case there’s a reader out there who sees the word CoCreateInstance and says, “Gosh, I don’t know what that is, and I’m going to declare this book useless unless it explains everything from first principles.”
What next? “The left open brace begins a block of statements”?
0 comments