1 /*-----------------------------------------------------------------------------
3 *-----------------------------------------------------------------------------
4 * Copyright (c) 2005 Kazuo Ishii <k-ishii@wb4.so-net.ne.jp>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *---------------------------------------------------------------------------*/
24 static HMODULE gDll = NULL;
26 typedef HIMC (WINAPI* FN_GetContext)(HWND);
27 typedef BOOL (WINAPI* FN_ReleaseContext)(HWND,HIMC);
28 typedef BOOL (WINAPI* FN_GetOpenStatus)(HIMC);
29 typedef BOOL (WINAPI* FN_SetCompositionFontW)(HIMC, LPLOGFONTW);
30 typedef BOOL (WINAPI* FN_SetCompositionWindow)(HIMC, PCOMPOSITIONFORM);
32 static FN_GetContext fn_GetContext = NULL;
33 static FN_ReleaseContext fn_ReleaseContext = NULL;
34 static FN_GetOpenStatus fn_GetOpenStatus = NULL;
35 static FN_SetCompositionFontW fn_SetCompositionFontW = NULL;
36 static FN_SetCompositionWindow fn_SetCompositionWindow = NULL;
38 HIMC WINAPI ImmGetContext(HWND hwnd)
41 return( fn_GetContext(hwnd) );
45 BOOL WINAPI ImmReleaseContext(HWND hwnd, HIMC imc)
48 return( fn_ReleaseContext(hwnd, imc) );
52 BOOL WINAPI ImmGetOpenStatus(HIMC imc)
55 return( fn_GetOpenStatus(imc) );
59 BOOL WINAPI ImmSetCompositionFontW(HIMC imc, LPLOGFONTW lf)
61 if(fn_SetCompositionFontW)
62 return( fn_SetCompositionFontW(imc, lf) );
66 BOOL WINAPI ImmSetCompositionWindow(HIMC imc, PCOMPOSITIONFORM cf)
68 if(fn_SetCompositionWindow)
69 return( fn_SetCompositionWindow(imc, cf) );
73 #define GET_PROC(name) \
75 fn_##name = (FN_##name) GetProcAddress(gDll, "Imm" #name); \
76 if(! fn_##name) result = FALSE; \
82 gDll = LoadLibraryA("imm32.dll");
85 GET_PROC( GetContext );
86 GET_PROC( ReleaseContext );
87 GET_PROC( GetOpenStatus );
88 GET_PROC( SetCompositionFontW );
89 GET_PROC( SetCompositionWindow );
92 fn_ReleaseContext = NULL;
93 fn_GetOpenStatus = NULL;
94 fn_SetCompositionFontW = NULL;
95 fn_SetCompositionWindow = NULL;