@@ -176,20 +176,22 @@ HRESULT ImeModule::registerServer(wchar_t* name, const GUID& profileGuid, LANGID
176
176
result = E_FAIL;
177
177
}
178
178
179
- // for Windows 8 store app support
180
- // TODO: according to a exhaustive Google search, I found that
181
- // TF_IPP_CAPS_IMMERSIVESUPPORT is required to make the IME work with Windows 8.
182
- // http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4c422cf1-ceb4-413b-8a7c-6881946a4c63/how-to-set-a-flag-indicating-tsf-components-compatibility
183
- // Quote from the page: "To indicate that your IME is compatible with Windows Store apps, call RegisterCategory with GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT."
184
-
185
- // declare supporting immersive mode
186
- if (categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, textServiceClsid_) != S_OK) {
187
- result = E_FAIL;
188
- }
179
+ if (isWindows8Above ()) {
180
+ // for Windows 8 store app support
181
+ // TODO: according to a exhaustive Google search, I found that
182
+ // TF_IPP_CAPS_IMMERSIVESUPPORT is required to make the IME work with Windows 8.
183
+ // http://social.msdn.microsoft.com/Forums/windowsapps/en-US/4c422cf1-ceb4-413b-8a7c-6881946a4c63/how-to-set-a-flag-indicating-tsf-components-compatibility
184
+ // Quote from the page: "To indicate that your IME is compatible with Windows Store apps, call RegisterCategory with GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT."
185
+
186
+ // declare supporting immersive mode
187
+ if (categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, textServiceClsid_) != S_OK) {
188
+ result = E_FAIL;
189
+ }
189
190
190
- // declare compatibility with Windows 8 system tray
191
- if (categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, textServiceClsid_) != S_OK) {
192
- result = E_FAIL;
191
+ // declare compatibility with Windows 8 system tray
192
+ if (categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, textServiceClsid_) != S_OK) {
193
+ result = E_FAIL;
194
+ }
193
195
}
194
196
195
197
categoryMgr->Release ();
@@ -212,9 +214,11 @@ HRESULT ImeModule::unregisterServer(const GUID& profileGuid) {
212
214
categoryMgr->UnregisterCategory (textServiceClsid_, GUID_TFCAT_TIP_KEYBOARD, textServiceClsid_);
213
215
categoryMgr->UnregisterCategory (textServiceClsid_, GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER, textServiceClsid_);
214
216
215
- // Windows 8 support
216
- categoryMgr->UnregisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, textServiceClsid_);
217
- categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, textServiceClsid_);
217
+ if (isWindows8Above ()) {
218
+ // Windows 8 support
219
+ categoryMgr->UnregisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_IMMERSIVESUPPORT, textServiceClsid_);
220
+ categoryMgr->RegisterCategory (textServiceClsid_, GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT, textServiceClsid_);
221
+ }
218
222
219
223
categoryMgr->Release ();
220
224
}
@@ -310,10 +314,11 @@ STDMETHODIMP ImeModule::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **
310
314
textServices_.push_back (service);
311
315
service->QueryInterface (riid, ppvObj);
312
316
service->Release ();
313
- return S_OK;
317
+ if (*ppvObj)
318
+ return S_OK;
314
319
}
315
320
}
316
- return S_FALSE ;
321
+ return E_NOINTERFACE ;
317
322
}
318
323
319
324
STDMETHODIMP ImeModule::LockServer (BOOL fLock ) {
0 commit comments