msvcrt: Convert all the printf functions to use MS ABI varargs.
[wine] / dlls / msimtf / activeimmapp.c
1 /*
2  *  ActiveIMMApp Interface
3  *
4  *  Copyright 2008  CodeWeavers, Aric Stewart
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include "config.h"
22
23 #include <stdarg.h>
24
25 #define COBJMACROS
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "wingdi.h"
30 #include "winreg.h"
31 #include "winuser.h"
32 #include "winerror.h"
33 #include "objbase.h"
34 #include "advpub.h"
35 #include "dimm.h"
36 #include "imm.h"
37
38 #include "wine/unicode.h"
39
40 #include "wine/debug.h"
41
42 WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
43
44 typedef struct tagActiveIMMApp {
45     const IActiveIMMAppVtbl *vtbl;
46     LONG refCount;
47 } ActiveIMMApp;
48
49 static void ActiveIMMApp_Destructor(ActiveIMMApp* This)
50 {
51     TRACE("\n");
52     HeapFree(GetProcessHeap(),0,This);
53 }
54
55 static HRESULT WINAPI ActiveIMMApp_QueryInterface (IActiveIMMApp* iface,
56         REFIID iid, LPVOID *ppvOut)
57 {
58     ActiveIMMApp *This = (ActiveIMMApp*)iface;
59     *ppvOut = NULL;
60
61     if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IActiveIMMApp))
62     {
63         *ppvOut = This;
64     }
65
66     if (*ppvOut)
67     {
68         IUnknown_AddRef(iface);
69         return S_OK;
70     }
71
72     WARN("unsupported interface: %s\n", debugstr_guid(iid));
73     return E_NOINTERFACE;
74 }
75
76 static ULONG WINAPI ActiveIMMApp_AddRef(IActiveIMMApp* iface)
77 {
78     ActiveIMMApp *This = (ActiveIMMApp*)iface;
79     return InterlockedIncrement(&This->refCount);
80 }
81
82 static ULONG WINAPI ActiveIMMApp_Release(IActiveIMMApp* iface)
83 {
84     ActiveIMMApp *This = (ActiveIMMApp*)iface;
85     ULONG ret;
86
87     ret = InterlockedDecrement(&This->refCount);
88     if (ret == 0)
89         ActiveIMMApp_Destructor(This);
90     return ret;
91 }
92
93 static HRESULT WINAPI ActiveIMMApp_AssociateContext(IActiveIMMApp* iface,
94         HWND hWnd, HIMC hIME, HIMC *phPrev)
95 {
96     *phPrev = ImmAssociateContext(hWnd,hIME);
97     return S_OK;
98 }
99
100 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEA(IActiveIMMApp* This,
101         HKL hKL, HWND hwnd, DWORD dwMode, REGISTERWORDA *pData)
102 {
103     BOOL rc;
104
105     rc = ImmConfigureIMEA(hKL, hwnd, dwMode, pData);
106     if (rc)
107         return E_FAIL;
108     else
109         return S_OK;
110 }
111
112 static HRESULT WINAPI ActiveIMMApp_ConfigureIMEW(IActiveIMMApp* This,
113         HKL hKL, HWND hWnd, DWORD dwMode, REGISTERWORDW *pData)
114 {
115     BOOL rc;
116
117     rc = ImmConfigureIMEW(hKL, hWnd, dwMode, pData);
118     if (rc)
119         return E_FAIL;
120     else
121         return S_OK;
122 }
123
124 static HRESULT WINAPI ActiveIMMApp_CreateContext(IActiveIMMApp* This,
125         HIMC *phIMC)
126 {
127     *phIMC = ImmCreateContext();
128     if (*phIMC)
129         return S_OK;
130     else
131         return E_FAIL;
132 }
133
134 static HRESULT WINAPI ActiveIMMApp_DestroyContext(IActiveIMMApp* This,
135         HIMC hIME)
136 {
137     BOOL rc;
138
139     rc = ImmDestroyContext(hIME);
140     if (rc)
141         return S_OK;
142     else
143         return E_FAIL;
144 }
145
146 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordA(IActiveIMMApp* This,
147         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister,
148         LPVOID pData, IEnumRegisterWordA **pEnum)
149 {
150     FIXME("Stub\n");
151     return E_NOTIMPL;
152 }
153
154 static HRESULT WINAPI ActiveIMMApp_EnumRegisterWordW(IActiveIMMApp* This,
155         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister,
156         LPVOID pData, IEnumRegisterWordW **pEnum)
157 {
158     FIXME("Stub\n");
159     return E_NOTIMPL;
160 }
161
162 static HRESULT WINAPI ActiveIMMApp_EscapeA(IActiveIMMApp* This,
163         HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
164 {
165     *plResult = ImmEscapeA(hKL, hIMC, uEscape, pData);
166     return S_OK;
167 }
168
169 static HRESULT WINAPI ActiveIMMApp_EscapeW(IActiveIMMApp* This,
170         HKL hKL, HIMC hIMC, UINT uEscape, LPVOID pData, LRESULT *plResult)
171 {
172     *plResult = ImmEscapeW(hKL, hIMC, uEscape, pData);
173     return S_OK;
174 }
175
176 static HRESULT WINAPI ActiveIMMApp_GetCandidateListA(IActiveIMMApp* This,
177         HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
178         UINT *puCopied)
179 {
180     *puCopied = ImmGetCandidateListA(hIMC, dwIndex, pCandList, uBufLen);
181     return S_OK;
182 }
183
184 static HRESULT WINAPI ActiveIMMApp_GetCandidateListW(IActiveIMMApp* This,
185         HIMC hIMC, DWORD dwIndex, UINT uBufLen, CANDIDATELIST *pCandList,
186         UINT *puCopied)
187 {
188     *puCopied = ImmGetCandidateListW(hIMC, dwIndex, pCandList, uBufLen);
189     return S_OK;
190 }
191
192 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountA(IActiveIMMApp* This,
193         HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
194 {
195    *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
196     return S_OK;
197 }
198
199 static HRESULT WINAPI ActiveIMMApp_GetCandidateListCountW(IActiveIMMApp* This,
200         HIMC hIMC, DWORD *pdwListSize, DWORD *pdwBufLen)
201 {
202    *pdwBufLen = ImmGetCandidateListCountA(hIMC, pdwListSize);
203     return S_OK;
204 }
205
206 static HRESULT WINAPI ActiveIMMApp_GetCandidateWindow(IActiveIMMApp* This,
207         HIMC hIMC, DWORD dwIndex, CANDIDATEFORM *pCandidate)
208 {
209     BOOL rc;
210     rc = ImmGetCandidateWindow(hIMC,dwIndex,pCandidate);
211     if (rc)
212         return S_OK;
213     else
214         return E_FAIL;
215 }
216
217 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontA(IActiveIMMApp* This,
218         HIMC hIMC, LOGFONTA *plf)
219 {
220     BOOL rc;
221     rc = ImmGetCompositionFontA(hIMC,plf);
222     if (rc)
223         return S_OK;
224     else
225         return E_FAIL;
226 }
227
228 static HRESULT WINAPI ActiveIMMApp_GetCompositionFontW(IActiveIMMApp* This,
229         HIMC hIMC, LOGFONTW *plf)
230 {
231     BOOL rc;
232     rc = ImmGetCompositionFontW(hIMC,plf);
233     if (rc)
234         return S_OK;
235     else
236         return E_FAIL;
237 }
238
239 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringA(IActiveIMMApp* This,
240         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
241 {
242     *plCopied = ImmGetCompositionStringA(hIMC, dwIndex, pBuf, dwBufLen);
243     return S_OK;
244 }
245
246 static HRESULT WINAPI ActiveIMMApp_GetCompositionStringW(IActiveIMMApp* This,
247         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LONG *plCopied, LPVOID pBuf)
248 {
249     *plCopied = ImmGetCompositionStringW(hIMC, dwIndex, pBuf, dwBufLen);
250     return S_OK;
251 }
252
253 static HRESULT WINAPI ActiveIMMApp_GetCompositionWindow(IActiveIMMApp* This,
254         HIMC hIMC, COMPOSITIONFORM *pCompForm)
255 {
256     BOOL rc;
257
258     rc = ImmGetCompositionWindow(hIMC,pCompForm);
259
260     if (rc)
261         return S_OK;
262     else
263         return E_FAIL;
264 }
265
266 static HRESULT WINAPI ActiveIMMApp_GetContext(IActiveIMMApp* This,
267         HWND hwnd, HIMC *phIMC)
268 {
269     *phIMC = ImmGetContext(hwnd);
270     return S_OK;
271 }
272
273 static HRESULT WINAPI ActiveIMMApp_GetConversionListA(IActiveIMMApp* This,
274         HKL hKL, HIMC hIMC, LPSTR pSrc, UINT uBufLen, UINT uFlag,
275         CANDIDATELIST *pDst, UINT *puCopied)
276 {
277     *puCopied = ImmGetConversionListA(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
278     return S_OK;
279 }
280
281 static HRESULT WINAPI ActiveIMMApp_GetConversionListW(IActiveIMMApp* This,
282         HKL hKL, HIMC hIMC, LPWSTR pSrc, UINT uBufLen, UINT uFlag,
283         CANDIDATELIST *pDst, UINT *puCopied)
284 {
285     *puCopied = ImmGetConversionListW(hKL, hIMC, pSrc, pDst, uBufLen, uFlag);
286     return S_OK;
287 }
288
289 static HRESULT WINAPI ActiveIMMApp_GetConversionStatus(IActiveIMMApp* This,
290         HIMC hIMC, DWORD *pfdwConversion, DWORD *pfdwSentence)
291 {
292     BOOL rc;
293
294     rc = ImmGetConversionStatus(hIMC, pfdwConversion, pfdwSentence);
295
296     if (rc)
297         return S_OK;
298     else
299         return E_FAIL;
300 }
301
302 static HRESULT WINAPI ActiveIMMApp_GetDefaultIMEWnd(IActiveIMMApp* This,
303         HWND hWnd, HWND *phDefWnd)
304 {
305     *phDefWnd = ImmGetDefaultIMEWnd(hWnd);
306     return S_OK;
307 }
308
309 static HRESULT WINAPI ActiveIMMApp_GetDescriptionA(IActiveIMMApp* This,
310         HKL hKL, UINT uBufLen, LPSTR szDescription, UINT *puCopied)
311 {
312     *puCopied = ImmGetDescriptionA(hKL, szDescription, uBufLen);
313     return S_OK;
314 }
315
316 static HRESULT WINAPI ActiveIMMApp_GetDescriptionW(IActiveIMMApp* This,
317         HKL hKL, UINT uBufLen, LPWSTR szDescription, UINT *puCopied)
318 {
319     *puCopied = ImmGetDescriptionW(hKL, szDescription, uBufLen);
320     return S_OK;
321 }
322
323 static HRESULT WINAPI ActiveIMMApp_GetGuideLineA(IActiveIMMApp* This,
324         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPSTR pBuf,
325         DWORD *pdwResult)
326 {
327     *pdwResult = ImmGetGuideLineA(hIMC, dwIndex, pBuf, dwBufLen);
328     return S_OK;
329 }
330
331 static HRESULT WINAPI ActiveIMMApp_GetGuideLineW(IActiveIMMApp* This,
332         HIMC hIMC, DWORD dwIndex, DWORD dwBufLen, LPWSTR pBuf,
333         DWORD *pdwResult)
334 {
335     *pdwResult = ImmGetGuideLineW(hIMC, dwIndex, pBuf, dwBufLen);
336     return S_OK;
337 }
338
339 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameA(IActiveIMMApp* This,
340         HKL hKL, UINT uBufLen, LPSTR szFileName, UINT *puCopied)
341 {
342     *puCopied = ImmGetIMEFileNameA(hKL, szFileName, uBufLen);
343     return S_OK;
344 }
345
346 static HRESULT WINAPI ActiveIMMApp_GetIMEFileNameW(IActiveIMMApp* This,
347         HKL hKL, UINT uBufLen, LPWSTR szFileName, UINT *puCopied)
348 {
349     *puCopied = ImmGetIMEFileNameW(hKL, szFileName, uBufLen);
350     return S_OK;
351 }
352
353 static HRESULT WINAPI ActiveIMMApp_GetOpenStatus(IActiveIMMApp* This,
354         HIMC hIMC)
355 {
356     return ImmGetOpenStatus(hIMC);
357 }
358
359 static HRESULT WINAPI ActiveIMMApp_GetProperty(IActiveIMMApp* This,
360         HKL hKL, DWORD fdwIndex, DWORD *pdwProperty)
361 {
362     *pdwProperty = ImmGetProperty(hKL, fdwIndex);
363     return S_OK;
364 }
365
366 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleA(IActiveIMMApp* This,
367         HKL hKL, UINT nItem, STYLEBUFA *pStyleBuf, UINT *puCopied)
368 {
369     *puCopied = ImmGetRegisterWordStyleA(hKL, nItem, pStyleBuf);
370     return S_OK;
371 }
372
373 static HRESULT WINAPI ActiveIMMApp_GetRegisterWordStyleW(IActiveIMMApp* This,
374         HKL hKL, UINT nItem, STYLEBUFW *pStyleBuf, UINT *puCopied)
375 {
376     *puCopied = ImmGetRegisterWordStyleW(hKL, nItem, pStyleBuf);
377     return S_OK;
378 }
379
380 static HRESULT WINAPI ActiveIMMApp_GetStatusWindowPos(IActiveIMMApp* This,
381         HIMC hIMC, POINT *pptPos)
382 {
383     BOOL rc;
384     rc = ImmGetStatusWindowPos(hIMC, pptPos);
385
386     if (rc)
387         return S_OK;
388     else
389         return E_FAIL;
390 }
391
392 static HRESULT WINAPI ActiveIMMApp_GetVirtualKey(IActiveIMMApp* This,
393         HWND hWnd, UINT *puVirtualKey)
394 {
395     *puVirtualKey = ImmGetVirtualKey(hWnd);
396     return S_OK;
397 }
398
399 static HRESULT WINAPI ActiveIMMApp_InstallIMEA(IActiveIMMApp* This,
400         LPSTR szIMEFileName, LPSTR szLayoutText, HKL *phKL)
401 {
402     *phKL = ImmInstallIMEA(szIMEFileName,szLayoutText);
403     return S_OK;
404 }
405
406 static HRESULT WINAPI ActiveIMMApp_InstallIMEW(IActiveIMMApp* This,
407         LPWSTR szIMEFileName, LPWSTR szLayoutText, HKL *phKL)
408 {
409     *phKL = ImmInstallIMEW(szIMEFileName,szLayoutText);
410     return S_OK;
411 }
412
413 static HRESULT WINAPI ActiveIMMApp_IsIME(IActiveIMMApp* This,
414         HKL hKL)
415 {
416     return ImmIsIME(hKL);
417 }
418
419 static HRESULT WINAPI ActiveIMMApp_IsUIMessageA(IActiveIMMApp* This,
420         HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
421 {
422     return ImmIsUIMessageA(hWndIME,msg,wParam,lParam);
423 }
424
425 static HRESULT WINAPI ActiveIMMApp_IsUIMessageW(IActiveIMMApp* This,
426         HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam)
427 {
428     return ImmIsUIMessageW(hWndIME,msg,wParam,lParam);
429 }
430
431 static HRESULT WINAPI ActiveIMMApp_NotifyIME(IActiveIMMApp* This,
432         HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
433 {
434     BOOL rc;
435
436     rc = ImmNotifyIME(hIMC,dwAction,dwIndex,dwValue);
437
438     if (rc)
439         return S_OK;
440     else
441         return E_FAIL;
442 }
443
444 static HRESULT WINAPI ActiveIMMApp_RegisterWordA(IActiveIMMApp* This,
445         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szRegister)
446 {
447     BOOL rc;
448
449     rc = ImmRegisterWordA(hKL,szReading,dwStyle,szRegister);
450
451     if (rc)
452         return S_OK;
453     else
454         return E_FAIL;
455 }
456
457 static HRESULT WINAPI ActiveIMMApp_RegisterWordW(IActiveIMMApp* This,
458         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szRegister)
459 {
460     BOOL rc;
461
462     rc = ImmRegisterWordW(hKL,szReading,dwStyle,szRegister);
463
464     if (rc)
465         return S_OK;
466     else
467         return E_FAIL;
468 }
469
470 static HRESULT WINAPI ActiveIMMApp_ReleaseContext(IActiveIMMApp* This,
471         HWND hWnd, HIMC hIMC)
472 {
473     BOOL rc;
474
475     rc = ImmReleaseContext(hWnd,hIMC);
476
477     if (rc)
478         return S_OK;
479     else
480         return E_FAIL;
481 }
482
483 static HRESULT WINAPI ActiveIMMApp_SetCandidateWindow(IActiveIMMApp* This,
484         HIMC hIMC, CANDIDATEFORM *pCandidate)
485 {
486     BOOL rc;
487
488     rc = ImmSetCandidateWindow(hIMC,pCandidate);
489
490     if (rc)
491         return S_OK;
492     else
493         return E_FAIL;
494 }
495
496 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontA(IActiveIMMApp* This,
497         HIMC hIMC, LOGFONTA *plf)
498 {
499     BOOL rc;
500
501     rc = ImmSetCompositionFontA(hIMC,plf);
502
503     if (rc)
504         return S_OK;
505     else
506         return E_FAIL;
507 }
508
509 static HRESULT WINAPI ActiveIMMApp_SetCompositionFontW(IActiveIMMApp* This,
510         HIMC hIMC, LOGFONTW *plf)
511 {
512     BOOL rc;
513
514     rc = ImmSetCompositionFontW(hIMC,plf);
515
516     if (rc)
517         return S_OK;
518     else
519         return E_FAIL;
520 }
521
522 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringA(IActiveIMMApp* This,
523         HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
524         LPVOID pRead, DWORD dwReadLen)
525 {
526     BOOL rc;
527
528     rc = ImmSetCompositionStringA(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
529
530     if (rc)
531         return S_OK;
532     else
533         return E_FAIL;
534 }
535
536 static HRESULT WINAPI ActiveIMMApp_SetCompositionStringW(IActiveIMMApp* This,
537         HIMC hIMC, DWORD dwIndex, LPVOID pComp, DWORD dwCompLen,
538         LPVOID pRead, DWORD dwReadLen)
539 {
540     BOOL rc;
541
542     rc = ImmSetCompositionStringW(hIMC,dwIndex,pComp,dwCompLen,pRead,dwReadLen);
543
544     if (rc)
545         return S_OK;
546     else
547         return E_FAIL;
548 }
549
550 static HRESULT WINAPI ActiveIMMApp_SetCompositionWindow(IActiveIMMApp* This,
551         HIMC hIMC, COMPOSITIONFORM *pCompForm)
552 {
553     BOOL rc;
554
555     rc = ImmSetCompositionWindow(hIMC,pCompForm);
556
557     if (rc)
558         return S_OK;
559     else
560         return E_FAIL;
561 }
562
563 static HRESULT WINAPI ActiveIMMApp_SetConversionStatus(IActiveIMMApp* This,
564         HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence)
565 {
566     BOOL rc;
567
568     rc = ImmSetConversionStatus(hIMC,fdwConversion,fdwSentence);
569
570     if (rc)
571         return S_OK;
572     else
573         return E_FAIL;
574 }
575
576 static HRESULT WINAPI ActiveIMMApp_SetOpenStatus(IActiveIMMApp* This,
577         HIMC hIMC, BOOL fOpen)
578 {
579     BOOL rc;
580
581     rc = ImmSetOpenStatus(hIMC,fOpen);
582
583     if (rc)
584         return S_OK;
585     else
586         return E_FAIL;
587 }
588
589 static HRESULT WINAPI ActiveIMMApp_SetStatusWindowPos(IActiveIMMApp* This,
590         HIMC hIMC, POINT *pptPos)
591 {
592     BOOL rc;
593
594     rc = ImmSetStatusWindowPos(hIMC,pptPos);
595
596     if (rc)
597         return S_OK;
598     else
599         return E_FAIL;
600 }
601
602 static HRESULT WINAPI ActiveIMMApp_SimulateHotKey(IActiveIMMApp* This,
603         HWND hwnd, DWORD dwHotKeyID)
604 {
605     BOOL rc;
606
607     rc = ImmSimulateHotKey(hwnd,dwHotKeyID);
608
609     if (rc)
610         return S_OK;
611     else
612         return E_FAIL;
613 }
614
615 static HRESULT WINAPI ActiveIMMApp_UnregisterWordA(IActiveIMMApp* This,
616         HKL hKL, LPSTR szReading, DWORD dwStyle, LPSTR szUnregister)
617 {
618     BOOL rc;
619
620     rc = ImmUnregisterWordA(hKL,szReading,dwStyle,szUnregister);
621
622     if (rc)
623         return S_OK;
624     else
625         return E_FAIL;
626
627 }
628
629 static HRESULT WINAPI ActiveIMMApp_UnregisterWordW(IActiveIMMApp* This,
630         HKL hKL, LPWSTR szReading, DWORD dwStyle, LPWSTR szUnregister)
631 {
632     BOOL rc;
633
634     rc = ImmUnregisterWordW(hKL,szReading,dwStyle,szUnregister);
635
636     if (rc)
637         return S_OK;
638     else
639         return E_FAIL;
640 }
641
642 static HRESULT WINAPI ActiveIMMApp_Activate(IActiveIMMApp* This,
643         BOOL fRestoreLayout)
644 {
645     FIXME("Stub\n");
646     return S_OK;
647 }
648
649 static HRESULT WINAPI ActiveIMMApp_Deactivate(IActiveIMMApp* This)
650 {
651     FIXME("Stub\n");
652     return S_OK;
653 }
654
655 static HRESULT WINAPI ActiveIMMApp_OnDefWindowProc(IActiveIMMApp* This,
656         HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
657 {
658     FIXME("Stub (%p %x %lx %lx)\n",hWnd,Msg,wParam,lParam);
659     return E_FAIL;
660 }
661
662 static HRESULT WINAPI ActiveIMMApp_FilterClientWindows(IActiveIMMApp* This,
663         ATOM *aaClassList, UINT uSize)
664 {
665     FIXME("Stub\n");
666     return S_OK;
667 }
668
669 static HRESULT WINAPI ActiveIMMApp_GetCodePageA(IActiveIMMApp* This,
670         HKL hKL, UINT *uCodePage)
671 {
672     FIXME("Stub\n");
673     return E_NOTIMPL;
674 }
675
676 static HRESULT WINAPI ActiveIMMApp_GetLangId(IActiveIMMApp* This,
677         HKL hKL, LANGID *plid)
678 {
679     FIXME("Stub\n");
680     return E_NOTIMPL;
681 }
682
683 static HRESULT WINAPI ActiveIMMApp_AssociateContextEx(IActiveIMMApp* This,
684         HWND hWnd, HIMC hIMC, DWORD dwFlags)
685 {
686     BOOL rc;
687
688     rc = ImmAssociateContextEx(hWnd,hIMC,dwFlags);
689
690     if (rc)
691         return S_OK;
692     else
693         return E_FAIL;
694 }
695
696 static HRESULT WINAPI ActiveIMMApp_DisableIME(IActiveIMMApp* This,
697         DWORD idThread)
698 {
699     BOOL rc;
700
701     rc = ImmDisableIME(idThread);
702
703     if (rc)
704         return S_OK;
705     else
706         return E_FAIL;
707 }
708
709 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsA(IActiveIMMApp* This,
710         HIMC hIMC, DWORD dwFlags, DWORD dwType,
711         IMEMENUITEMINFOA *pImeParentMenu, IMEMENUITEMINFOA *pImeMenu,
712         DWORD dwSize, DWORD *pdwResult)
713 {
714     *pdwResult = ImmGetImeMenuItemsA(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
715     return S_OK;
716 }
717
718 static HRESULT WINAPI ActiveIMMApp_GetImeMenuItemsW(IActiveIMMApp* This,
719         HIMC hIMC, DWORD dwFlags, DWORD dwType,
720         IMEMENUITEMINFOW *pImeParentMenu, IMEMENUITEMINFOW *pImeMenu,
721         DWORD dwSize, DWORD *pdwResult)
722 {
723     *pdwResult = ImmGetImeMenuItemsW(hIMC,dwFlags,dwType,pImeParentMenu,pImeMenu,dwSize);
724     return S_OK;
725 }
726
727 static HRESULT WINAPI ActiveIMMApp_EnumInputContext(IActiveIMMApp* This,
728         DWORD idThread, IEnumInputContext **ppEnum)
729 {
730     FIXME("Stub\n");
731     return E_NOTIMPL;
732 }
733
734 static const IActiveIMMAppVtbl ActiveIMMAppVtbl =
735 {
736     ActiveIMMApp_QueryInterface,
737     ActiveIMMApp_AddRef,
738     ActiveIMMApp_Release,
739
740     ActiveIMMApp_AssociateContext,
741     ActiveIMMApp_ConfigureIMEA,
742     ActiveIMMApp_ConfigureIMEW,
743     ActiveIMMApp_CreateContext,
744     ActiveIMMApp_DestroyContext,
745     ActiveIMMApp_EnumRegisterWordA,
746     ActiveIMMApp_EnumRegisterWordW,
747     ActiveIMMApp_EscapeA,
748     ActiveIMMApp_EscapeW,
749     ActiveIMMApp_GetCandidateListA,
750     ActiveIMMApp_GetCandidateListW,
751     ActiveIMMApp_GetCandidateListCountA,
752     ActiveIMMApp_GetCandidateListCountW,
753     ActiveIMMApp_GetCandidateWindow,
754     ActiveIMMApp_GetCompositionFontA,
755     ActiveIMMApp_GetCompositionFontW,
756     ActiveIMMApp_GetCompositionStringA,
757     ActiveIMMApp_GetCompositionStringW,
758     ActiveIMMApp_GetCompositionWindow,
759     ActiveIMMApp_GetContext,
760     ActiveIMMApp_GetConversionListA,
761     ActiveIMMApp_GetConversionListW,
762     ActiveIMMApp_GetConversionStatus,
763     ActiveIMMApp_GetDefaultIMEWnd,
764     ActiveIMMApp_GetDescriptionA,
765     ActiveIMMApp_GetDescriptionW,
766     ActiveIMMApp_GetGuideLineA,
767     ActiveIMMApp_GetGuideLineW,
768     ActiveIMMApp_GetIMEFileNameA,
769     ActiveIMMApp_GetIMEFileNameW,
770     ActiveIMMApp_GetOpenStatus,
771     ActiveIMMApp_GetProperty,
772     ActiveIMMApp_GetRegisterWordStyleA,
773     ActiveIMMApp_GetRegisterWordStyleW,
774     ActiveIMMApp_GetStatusWindowPos,
775     ActiveIMMApp_GetVirtualKey,
776     ActiveIMMApp_InstallIMEA,
777     ActiveIMMApp_InstallIMEW,
778     ActiveIMMApp_IsIME,
779     ActiveIMMApp_IsUIMessageA,
780     ActiveIMMApp_IsUIMessageW,
781     ActiveIMMApp_NotifyIME,
782     ActiveIMMApp_RegisterWordA,
783     ActiveIMMApp_RegisterWordW,
784     ActiveIMMApp_ReleaseContext,
785     ActiveIMMApp_SetCandidateWindow,
786     ActiveIMMApp_SetCompositionFontA,
787     ActiveIMMApp_SetCompositionFontW,
788     ActiveIMMApp_SetCompositionStringA,
789     ActiveIMMApp_SetCompositionStringW,
790     ActiveIMMApp_SetCompositionWindow,
791     ActiveIMMApp_SetConversionStatus,
792     ActiveIMMApp_SetOpenStatus,
793     ActiveIMMApp_SetStatusWindowPos,
794     ActiveIMMApp_SimulateHotKey,
795     ActiveIMMApp_UnregisterWordA,
796     ActiveIMMApp_UnregisterWordW,
797
798     ActiveIMMApp_Activate,
799     ActiveIMMApp_Deactivate,
800     ActiveIMMApp_OnDefWindowProc,
801     ActiveIMMApp_FilterClientWindows,
802     ActiveIMMApp_GetCodePageA,
803     ActiveIMMApp_GetLangId,
804     ActiveIMMApp_AssociateContextEx,
805     ActiveIMMApp_DisableIME,
806     ActiveIMMApp_GetImeMenuItemsA,
807     ActiveIMMApp_GetImeMenuItemsW,
808     ActiveIMMApp_EnumInputContext
809 };
810
811 HRESULT ActiveIMMApp_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
812 {
813     ActiveIMMApp *This;
814     if (pUnkOuter)
815         return CLASS_E_NOAGGREGATION;
816
817     This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ActiveIMMApp));
818     if (This == NULL)
819         return E_OUTOFMEMORY;
820
821     This->vtbl = &ActiveIMMAppVtbl;
822     This->refCount = 1;
823
824     TRACE("returning %p\n",This);
825     *ppOut = (IUnknown *)This;
826     return S_OK;
827 }