Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

country3.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

void GetCompositionStr (HWND hwnd, LPARAM CompFlag, WPARAM CompChar)
void GetCompStrJapan (HWND hwnd, PCONSOLE_TABLE ConTbl, LPARAM CompFlag)
void GetCompStrTaiwan (HWND hwnd, PCONSOLE_TABLE ConTbl, LPARAM CompFlag)
void GetCompStrPRC (HWND hwnd, PCONSOLE_TABLE ConTbl, LPARAM CompFlag)
void GetCompStrKorea (HWND hwnd, PCONSOLE_TABLE ConTbl, LPARAM CompFlag, WPARAM CompChar)
VOID ReDisplayCompositionStr (HWND hwnd)
VOID ReDisplayCompStrJapan (HWND hwnd, PCONSOLE_TABLE ConTbl)
VOID ReDisplayCompStrTaiwan (HWND hwnd, PCONSOLE_TABLE ConTbl)
VOID ReDisplayCompStrPRC (HWND hwnd, PCONSOLE_TABLE ConTbl)
VOID ReDisplayCompStrKorea (HWND hwnd, PCONSOLE_TABLE ConTbl)


Function Documentation

void GetCompositionStr HWND  hwnd,
LPARAM  CompFlag,
WPARAM  CompChar
 

Definition at line 32 of file country3.c.

References _CONSOLE_TABLE::ConsoleOutputCP, DBGPRINT, GetCompStrJapan(), GetCompStrKorea(), GetCompStrPRC(), GetCompStrTaiwan(), JAPAN_CODEPAGE, KOREA_CODEPAGE, LastConsole, NULL, PRC_CODEPAGE, SearchConsole(), and TAIWAN_CODEPAGE.

Referenced by ImeUIComposition().

00037 { 00038 PCONSOLE_TABLE ConTbl; 00039 00040 DBGPRINT(("CONIME: GetCompositionStr\n")); 00041 00042 ConTbl = SearchConsole(LastConsole); 00043 if (ConTbl == NULL) { 00044 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00045 return; 00046 } 00047 00048 switch (ConTbl->ConsoleOutputCP) 00049 { 00050 case JAPAN_CODEPAGE: 00051 GetCompStrJapan(hwnd, ConTbl, CompFlag); 00052 break; 00053 case TAIWAN_CODEPAGE: 00054 GetCompStrTaiwan(hwnd, ConTbl, CompFlag); 00055 break; 00056 case PRC_CODEPAGE: 00057 GetCompStrPRC(hwnd, ConTbl, CompFlag); 00058 break; 00059 case KOREA_CODEPAGE: 00060 GetCompStrKorea(hwnd, ConTbl, CompFlag, CompChar); 00061 break; 00062 default: 00063 break; 00064 } 00065 return; 00066 00067 }

void GetCompStrJapan HWND  hwnd,
PCONSOLE_TABLE  ConTbl,
LPARAM  CompFlag
 

Definition at line 70 of file country3.c.

References BYTE, CI_CONIMECOMPOSITION, _CONSOLE_TABLE::CompAttrColor, _CONIME_UICOMPMESSAGE::CompAttrColor, ConsoleImeSendMessage(), DBGPRINT, DisplayCompString(), DisplayResultString(), _CONIME_UICOMPMESSAGE::dwCompAttrLen, _CONIME_UICOMPMESSAGE::dwCompAttrOffset, _CONIME_UICOMPMESSAGE::dwCompStrLen, _CONIME_UICOMPMESSAGE::dwCompStrOffset, DWORD, _CONIME_UICOMPMESSAGE::dwResultStrLen, _CONIME_UICOMPMESSAGE::dwResultStrOffset, _CONIME_UICOMPMESSAGE::dwSize, FAR, _CONSOLE_TABLE::hWndCon, ImmGetContext(), ImmReleaseContext(), _CONSOLE_TABLE::lpCompStrMem, NULL, and UINT.

Referenced by GetCompositionStr().

00075 { 00076 HIMC hIMC; // Input context handle. 00077 DWORD dwBufLen; // Stogare for len. of composition str 00078 DWORD dwBufLenAttr; 00079 COPYDATASTRUCT CopyData; 00080 DWORD SizeToAlloc; 00081 PWCHAR TempBuf; 00082 PUCHAR TempBufA; 00083 DWORD i; 00084 DWORD CursorPos; 00085 LPCONIME_UICOMPMESSAGE lpCompStrMem; 00086 00087 // 00088 // If fail to get input context handle then do nothing. 00089 // Applications should call ImmGetContext API to get 00090 // input context handle. 00091 // 00092 hIMC = ImmGetContext( hwnd ); 00093 if ( hIMC == 0 ) 00094 return; 00095 00096 if (CompFlag & GCS_COMPSTR) 00097 { 00098 // 00099 // Determines how much memory space to store the composition string. 00100 // Applications should call ImmGetCompositionString with 00101 // GCS_COMPSTR flag on, buffer length zero, to get the bullfer 00102 // length. 00103 // 00104 dwBufLen = ImmGetCompositionString( hIMC, GCS_COMPSTR, (void FAR*)NULL, 0l ); 00105 if ( dwBufLen < 0 ) { 00106 ImmReleaseContext( hwnd, hIMC ); 00107 return; 00108 } 00109 if ( CompFlag & GCS_COMPATTR ) 00110 { 00111 DBGPRINT((" GCS_COMPATTR\n")); 00112 dwBufLenAttr = ImmGetCompositionString( hIMC, GCS_COMPATTR,( void FAR *)NULL, 0l ); 00113 if ( dwBufLenAttr < 0 ) { 00114 dwBufLenAttr = 0; 00115 } 00116 } 00117 else { 00118 dwBufLenAttr = 0; 00119 } 00120 } 00121 else if (CompFlag & GCS_RESULTSTR) 00122 { 00123 // 00124 // Determines how much memory space to store the result string. 00125 // Applications should call ImmGetCompositionString with 00126 // GCS_RESULTSTR flag on, buffer length zero, to get the bullfer 00127 // length. 00128 // 00129 dwBufLen = ImmGetCompositionString( hIMC, GCS_RESULTSTR, (void FAR *)NULL, 0l ); 00130 if ( dwBufLen < 0 ) { 00131 ImmReleaseContext( hwnd, hIMC ); 00132 return; 00133 } 00134 dwBufLenAttr = 0; 00135 } 00136 else if (CompFlag == 0) 00137 { 00138 dwBufLen = 0; 00139 dwBufLenAttr = 0; 00140 } 00141 00142 SizeToAlloc = (UINT)( sizeof(CONIME_UICOMPMESSAGE) + 00143 dwBufLen + sizeof(WCHAR) + 00144 dwBufLenAttr + sizeof(BYTE) ); 00145 00146 if ( ConTbl->lpCompStrMem != NULL && 00147 SizeToAlloc > ConTbl->lpCompStrMem->dwSize 00148 ) 00149 { 00150 LocalFree( ConTbl->lpCompStrMem ); 00151 ConTbl->lpCompStrMem = NULL; 00152 } 00153 00154 if (ConTbl->lpCompStrMem == NULL) { 00155 ConTbl->lpCompStrMem = (LPCONIME_UICOMPMESSAGE)LocalAlloc(LPTR, SizeToAlloc ); 00156 if ( ConTbl->lpCompStrMem == NULL) { 00157 ImmReleaseContext( hwnd, hIMC ); 00158 return; 00159 } 00160 ConTbl->lpCompStrMem->dwSize = SizeToAlloc; 00161 } 00162 00163 lpCompStrMem = ConTbl->lpCompStrMem; 00164 RtlZeroMemory(&lpCompStrMem->dwCompAttrLen, 00165 lpCompStrMem->dwSize - sizeof(lpCompStrMem->dwSize) 00166 ); 00167 00168 TempBuf = (PWCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE)); 00169 TempBufA = (PUCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE) + 00170 dwBufLen + sizeof(WCHAR)); 00171 00172 CopyMemory(lpCompStrMem->CompAttrColor , ConTbl->CompAttrColor , 8 * sizeof(WCHAR)); 00173 00174 CopyData.dwData = CI_CONIMECOMPOSITION; 00175 CopyData.cbData = lpCompStrMem->dwSize; 00176 CopyData.lpData = lpCompStrMem; 00177 00178 if (CompFlag & GCS_COMPSTR) 00179 { 00180 // 00181 // Reads in the composition string. 00182 // 00183 ImmGetCompositionString( hIMC, GCS_COMPSTR, TempBuf, dwBufLen ); 00184 00185 // 00186 // Null terminated. 00187 // 00188 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00189 00190 // 00191 // If GCS_COMPATTR flag is on, then we need to take care of it. 00192 // 00193 if ( dwBufLenAttr != 0 ) 00194 { 00195 ImmGetCompositionString( hIMC, 00196 GCS_COMPATTR, 00197 TempBufA, 00198 dwBufLenAttr ); 00199 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00200 } 00201 00202 CursorPos = ImmGetCompositionString( hIMC, GCS_CURSORPOS, NULL, 0 ); 00203 if (CursorPos == 0) 00204 TempBufA[ CursorPos ] |= (BYTE)0x20; 00205 else 00206 TempBufA[ CursorPos-1 ] |= (BYTE)0x10; 00207 00208 #ifdef DEBUG_INFO 00209 // 00210 // Display new composition chars. 00211 // 00212 xPos = (UINT)dwBufLen; 00213 xPosLast = (UINT)dwBufLen; 00214 00215 DisplayCompString( hwnd, dwBufLen / sizeof(WCHAR), TempBuf, TempBufA ); 00216 #endif 00217 00218 lpCompStrMem->dwCompStrLen = dwBufLen; 00219 if (lpCompStrMem->dwCompStrLen) 00220 lpCompStrMem->dwCompStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00221 00222 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00223 if (lpCompStrMem->dwCompAttrLen) 00224 lpCompStrMem->dwCompAttrOffset = sizeof(CONIME_UICOMPMESSAGE) + dwBufLen + sizeof(WCHAR); 00225 } 00226 else if (CompFlag & GCS_RESULTSTR) 00227 { 00228 // 00229 // Reads in the result string. 00230 // 00231 ImmGetCompositionString( hIMC, GCS_RESULTSTR, TempBuf, dwBufLen ); 00232 00233 // 00234 // Null terminated. 00235 // 00236 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00237 00238 #ifdef DEBUG_INFO 00239 // 00240 // Displays the result string. 00241 // 00242 DisplayResultString( hwnd, TempBuf ); 00243 #endif 00244 00245 lpCompStrMem->dwResultStrLen = dwBufLen; 00246 if (lpCompStrMem->dwResultStrLen) 00247 lpCompStrMem->dwResultStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00248 } 00249 else if (CompFlag == 0) 00250 { 00251 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00252 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00253 lpCompStrMem->dwResultStrLen = dwBufLen; 00254 lpCompStrMem->dwCompStrLen = dwBufLen; 00255 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00256 } 00257 00258 // 00259 // send character to Console 00260 // 00261 ConsoleImeSendMessage( ConTbl->hWndCon, 00262 (WPARAM)hwnd, 00263 (LPARAM)&CopyData 00264 ); 00265 00266 ImmReleaseContext( hwnd, hIMC ); 00267 00268 }

void GetCompStrKorea HWND  hwnd,
PCONSOLE_TABLE  ConTbl,
LPARAM  CompFlag,
WPARAM  CompChar
 

Definition at line 700 of file country3.c.

References BYTE, CI_CONIMECOMPOSITION, _CONSOLE_TABLE::CompAttrColor, _CONIME_UICOMPMESSAGE::CompAttrColor, ConsoleImeSendMessage(), DBGPRINT, DisplayCompString(), DisplayResultString(), _CONIME_UICOMPMESSAGE::dwCompAttrLen, _CONIME_UICOMPMESSAGE::dwCompAttrOffset, _CONIME_UICOMPMESSAGE::dwCompStrLen, _CONIME_UICOMPMESSAGE::dwCompStrOffset, DWORD, _CONIME_UICOMPMESSAGE::dwResultStrLen, _CONIME_UICOMPMESSAGE::dwResultStrOffset, _CONIME_UICOMPMESSAGE::dwSize, FAR, _CONSOLE_TABLE::hWndCon, ImmGetContext(), ImmReleaseContext(), _CONSOLE_TABLE::lpCompStrMem, NULL, and UINT.

Referenced by GetCompositionStr().

00706 { 00707 HIMC hIMC; // Input context handle. 00708 DWORD dwBufLen; // Stogare for len. of composition str 00709 DWORD dwBufLenAttr; 00710 COPYDATASTRUCT CopyData; 00711 DWORD SizeToAlloc; 00712 PWCHAR TempBuf; 00713 PUCHAR TempBufA; 00714 DWORD i; 00715 DWORD CursorPos; 00716 LPCONIME_UICOMPMESSAGE lpCompStrMem; 00717 00718 // 00719 // If fail to get input context handle then do nothing. 00720 // Applications should call ImmGetContext API to get 00721 // input context handle. 00722 // 00723 hIMC = ImmGetContext( hwnd ); 00724 if ( hIMC == 0 ) 00725 return; 00726 00727 // if (CompFlag & CS_INSERTCHAR) 00728 // { 00729 // dwBufLen = 1; 00730 // dwBufLenAttr = 1; 00731 // } 00732 // else 00733 if (CompFlag & GCS_COMPSTR) 00734 { 00735 // 00736 // Determines how much memory space to store the composition string. 00737 // Applications should call ImmGetCompositionString with 00738 // GCS_COMPSTR flag on, buffer length zero, to get the bullfer 00739 // length. 00740 // 00741 dwBufLen = ImmGetCompositionString( hIMC, GCS_COMPSTR, (void FAR*)NULL, 0l ); 00742 if ( dwBufLen < 0 ) { 00743 ImmReleaseContext( hwnd, hIMC ); 00744 return; 00745 } 00746 if ( CompFlag & GCS_COMPATTR ) 00747 { 00748 DBGPRINT((" GCS_COMPATTR\n")); 00749 dwBufLenAttr = ImmGetCompositionString( hIMC, GCS_COMPATTR,( void FAR *)NULL, 0l ); 00750 if ( dwBufLenAttr < 0 ) { 00751 dwBufLenAttr = 0; 00752 } 00753 } 00754 else { 00755 dwBufLenAttr = dwBufLen; 00756 } 00757 } 00758 else if (CompFlag & GCS_RESULTSTR) 00759 { 00760 // 00761 // Determines how much memory space to store the result string. 00762 // Applications should call ImmGetCompositionString with 00763 // GCS_RESULTSTR flag on, buffer length zero, to get the bullfer 00764 // length. 00765 // 00766 dwBufLen = ImmGetCompositionString( hIMC, GCS_RESULTSTR, (void FAR *)NULL, 0l ); 00767 if ( dwBufLen < 0 ) { 00768 ImmReleaseContext( hwnd, hIMC ); 00769 return; 00770 } 00771 dwBufLenAttr = 0; 00772 } 00773 else if (CompFlag == 0) 00774 { 00775 dwBufLen = 0; 00776 dwBufLenAttr = 0; 00777 } 00778 else 00779 { 00780 return; 00781 } 00782 00783 SizeToAlloc = (UINT)( sizeof(CONIME_UICOMPMESSAGE) + 00784 dwBufLen + sizeof(WCHAR) + 00785 dwBufLenAttr + sizeof(BYTE) ); 00786 00787 if ( ConTbl->lpCompStrMem != NULL && 00788 SizeToAlloc > ConTbl->lpCompStrMem->dwSize 00789 ) 00790 { 00791 LocalFree( ConTbl->lpCompStrMem ); 00792 ConTbl->lpCompStrMem = NULL; 00793 } 00794 00795 if (ConTbl->lpCompStrMem == NULL) { 00796 ConTbl->lpCompStrMem = (LPCONIME_UICOMPMESSAGE)LocalAlloc(LPTR, SizeToAlloc ); 00797 if ( ConTbl->lpCompStrMem == NULL) { 00798 ImmReleaseContext( hwnd, hIMC ); 00799 return; 00800 } 00801 ConTbl->lpCompStrMem->dwSize = SizeToAlloc; 00802 } 00803 00804 lpCompStrMem = ConTbl->lpCompStrMem; 00805 RtlZeroMemory(&lpCompStrMem->dwCompAttrLen, 00806 lpCompStrMem->dwSize - sizeof(lpCompStrMem->dwSize) 00807 ); 00808 00809 TempBuf = (PWCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE)); 00810 TempBufA = (PUCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE) + 00811 dwBufLen + sizeof(WCHAR)); 00812 00813 CopyMemory(lpCompStrMem->CompAttrColor , ConTbl->CompAttrColor , 8 * sizeof(WCHAR)); 00814 00815 CopyData.dwData = CI_CONIMECOMPOSITION; 00816 CopyData.cbData = lpCompStrMem->dwSize; 00817 CopyData.lpData = lpCompStrMem; 00818 00819 if (CompFlag & CS_INSERTCHAR) 00820 { 00821 *TempBuf = (WORD)CompChar; 00822 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00823 *TempBufA = (BYTE)ATTR_TARGET_CONVERTED; 00824 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00825 } 00826 else if (CompFlag & GCS_COMPSTR) 00827 { 00828 // 00829 // Reads in the composition string. 00830 // 00831 ImmGetCompositionString( hIMC, GCS_COMPSTR, TempBuf, dwBufLen ); 00832 00833 // 00834 // Null terminated. 00835 // 00836 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00837 00838 // 00839 // If GCS_COMPATTR flag is on, then we need to take care of it. 00840 // 00841 if ( dwBufLenAttr != 0 ) 00842 { 00843 if ( CompFlag & GCS_COMPATTR ) 00844 { 00845 ImmGetCompositionString( hIMC, 00846 GCS_COMPATTR, 00847 TempBufA, 00848 dwBufLenAttr ); 00849 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00850 } 00851 else 00852 { 00853 for (i = 0; i <= dwBufLenAttr; i++) 00854 TempBufA[ i ] = (BYTE)1; 00855 } 00856 } 00857 00858 // Korean NT does not need IME cursor. v-hirshi 00859 // CursorPos = ImmGetCompositionString( hIMC, GCS_CURSORPOS, NULL, 0 ); 00860 // if (CursorPos == 0) 00861 // TempBufA[ CursorPos ] |= (BYTE)0x20; 00862 // else 00863 // TempBufA[ CursorPos-1 ] |= (BYTE)0x10; 00864 00865 #ifdef DEBUG_INFO 00866 // 00867 // Display new composition chars. 00868 // 00869 xPos = (UINT)dwBufLen; 00870 xPosLast = (UINT)dwBufLen; 00871 00872 DisplayCompString( hwnd, dwBufLen / sizeof(WCHAR), TempBuf, TempBufA ); 00873 #endif 00874 00875 lpCompStrMem->dwCompStrLen = dwBufLen; 00876 if (lpCompStrMem->dwCompStrLen) 00877 lpCompStrMem->dwCompStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00878 00879 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00880 if (lpCompStrMem->dwCompAttrLen) 00881 lpCompStrMem->dwCompAttrOffset = sizeof(CONIME_UICOMPMESSAGE) + dwBufLen + sizeof(WCHAR); 00882 } 00883 else if (CompFlag & GCS_RESULTSTR) 00884 { 00885 // 00886 // Reads in the result string. 00887 // 00888 ImmGetCompositionString( hIMC, GCS_RESULTSTR, TempBuf, dwBufLen ); 00889 00890 // 00891 // Null terminated. 00892 // 00893 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00894 00895 #ifdef DEBUG_INFO 00896 // 00897 // Displays the result string. 00898 // 00899 DisplayResultString( hwnd, TempBuf ); 00900 #endif 00901 00902 lpCompStrMem->dwResultStrLen = dwBufLen; 00903 if (lpCompStrMem->dwResultStrLen) 00904 lpCompStrMem->dwResultStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00905 } 00906 else if (CompFlag == 0) 00907 { 00908 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00909 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00910 lpCompStrMem->dwResultStrLen = dwBufLen; 00911 lpCompStrMem->dwCompStrLen = dwBufLen; 00912 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00913 } 00914 00915 // 00916 // send character to Console 00917 // 00918 ConsoleImeSendMessage( ConTbl->hWndCon, 00919 (WPARAM)hwnd, 00920 (LPARAM)&CopyData 00921 ); 00922 00923 ImmReleaseContext( hwnd, hIMC ); 00924 00925 }

void GetCompStrPRC HWND  hwnd,
PCONSOLE_TABLE  ConTbl,
LPARAM  CompFlag
 

Definition at line 486 of file country3.c.

References BYTE, CI_CONIMECOMPOSITION, CI_CONIMEMODEINFO, _CONSOLE_TABLE::CompAttrColor, _CONIME_UICOMPMESSAGE::CompAttrColor, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _CONIME_UICOMPMESSAGE::dwCompAttrLen, _CONIME_UICOMPMESSAGE::dwCompAttrOffset, _CONIME_UICOMPMESSAGE::dwCompStrLen, _CONIME_UICOMPMESSAGE::dwCompStrOffset, DWORD, _CONIME_UICOMPMESSAGE::dwResultStrLen, _CONIME_UICOMPMESSAGE::dwResultStrOffset, _CONIME_UICOMPMESSAGE::dwSize, FAR, _CONSOLE_TABLE::hWndCon, ImmGetContext(), ImmReleaseContext(), _CONSOLE_TABLE::lpCompStrMem, MakeInfoStringPRC(), NULL, and UINT.

Referenced by GetCompositionStr().

00491 { 00492 HIMC hIMC; // Input context handle. 00493 DWORD dwBufLen; // Stogare for len. of composition str 00494 DWORD dwBufLenAttr; 00495 DWORD SizeToAlloc; 00496 PWCHAR TempBuf; 00497 PUCHAR TempBufA; 00498 DWORD i; 00499 DWORD CursorPos; 00500 COPYDATASTRUCT CopyData; 00501 LPCONIME_UIMODEINFO lpModeInfo; 00502 LPCONIME_UICOMPMESSAGE lpCompStrMem; 00503 00504 // 00505 // If fail to get input context handle then do nothing. 00506 // Applications should call ImmGetContext API to get 00507 // input context handle. 00508 // 00509 hIMC = ImmGetContext( hwnd ); 00510 if ( hIMC == 0 ) 00511 return; 00512 00513 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ); 00514 if ( lpModeInfo == NULL) { 00515 ImmReleaseContext( hwnd, hIMC ); 00516 return; 00517 } 00518 00519 if (CompFlag & GCS_COMPSTR) 00520 { 00521 // 00522 // Determines how much memory space to store the composition string. 00523 // Applications should call ImmGetCompositionString with 00524 // GCS_COMPSTR flag on, buffer length zero, to get the bullfer 00525 // length. 00526 // 00527 dwBufLen = ImmGetCompositionString( hIMC, GCS_COMPSTR, (void FAR*)NULL, 0l ); 00528 if ( dwBufLen < 0 ) { 00529 ImmReleaseContext( hwnd, hIMC ); 00530 return; 00531 } 00532 if ( CompFlag & GCS_COMPATTR ) 00533 { 00534 DBGPRINT((" GCS_COMPATTR\n")); 00535 dwBufLenAttr = ImmGetCompositionString( hIMC, GCS_COMPATTR,( void FAR *)NULL, 0l ); 00536 if ( dwBufLenAttr < 0 ) { 00537 dwBufLenAttr = 0; 00538 } 00539 } 00540 else { 00541 dwBufLenAttr = 0; 00542 } 00543 } 00544 else if (CompFlag & GCS_RESULTSTR) 00545 { 00546 // 00547 // Determines how much memory space to store the result string. 00548 // Applications should call ImmGetCompositionString with 00549 // GCS_RESULTSTR flag on, buffer length zero, to get the bullfer 00550 // length. 00551 // 00552 dwBufLen = ImmGetCompositionString( hIMC, GCS_RESULTSTR, (void FAR *)NULL, 0l ); 00553 if ( dwBufLen < 0 ) { 00554 ImmReleaseContext( hwnd, hIMC ); 00555 return; 00556 } 00557 dwBufLenAttr = 0; 00558 } 00559 else if (CompFlag == 0) 00560 { 00561 dwBufLen = 0; 00562 dwBufLenAttr = 0; 00563 } 00564 00565 SizeToAlloc = (UINT)( sizeof(CONIME_UICOMPMESSAGE) + 00566 dwBufLen + sizeof(WCHAR) + 00567 dwBufLenAttr + sizeof(BYTE) ); 00568 00569 if ( ConTbl->lpCompStrMem != NULL && 00570 SizeToAlloc > ConTbl->lpCompStrMem->dwSize 00571 ) 00572 { 00573 LocalFree( ConTbl->lpCompStrMem ); 00574 ConTbl->lpCompStrMem = NULL; 00575 } 00576 00577 if (ConTbl->lpCompStrMem == NULL) { 00578 ConTbl->lpCompStrMem = (LPCONIME_UICOMPMESSAGE)LocalAlloc(LPTR, SizeToAlloc ); 00579 if ( ConTbl->lpCompStrMem == NULL) { 00580 ImmReleaseContext( hwnd, hIMC ); 00581 return; 00582 } 00583 ConTbl->lpCompStrMem->dwSize = SizeToAlloc; 00584 } 00585 00586 lpCompStrMem = ConTbl->lpCompStrMem; 00587 RtlZeroMemory(&lpCompStrMem->dwCompAttrLen, 00588 lpCompStrMem->dwSize - sizeof(lpCompStrMem->dwSize) 00589 ); 00590 00591 TempBuf = (PWCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE)); 00592 TempBufA = (PUCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE) + 00593 dwBufLen + sizeof(WCHAR)); 00594 00595 CopyMemory(lpCompStrMem->CompAttrColor , ConTbl->CompAttrColor , 8 * sizeof(WCHAR)); 00596 00597 if (CompFlag & GCS_COMPSTR) 00598 { 00599 // 00600 // Reads in the composition string. 00601 // 00602 ImmGetCompositionString( hIMC, GCS_COMPSTR, TempBuf, dwBufLen ); 00603 00604 // 00605 // Null terminated. 00606 // 00607 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00608 00609 // 00610 // If GCS_COMPATTR flag is on, then we need to take care of it. 00611 // 00612 if ( dwBufLenAttr != 0 ) 00613 { 00614 ImmGetCompositionString( hIMC, 00615 GCS_COMPATTR, 00616 TempBufA, 00617 dwBufLenAttr ); 00618 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00619 } 00620 00621 lpCompStrMem->dwCompStrLen = dwBufLen; 00622 if (lpCompStrMem->dwCompStrLen) 00623 lpCompStrMem->dwCompStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00624 00625 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00626 if (lpCompStrMem->dwCompAttrLen) 00627 lpCompStrMem->dwCompAttrOffset = sizeof(CONIME_UICOMPMESSAGE) + dwBufLen + sizeof(WCHAR); 00628 // 00629 // Display character to Console 00630 // 00631 CopyData.dwData = CI_CONIMEMODEINFO; 00632 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 00633 CopyData.lpData = lpModeInfo; 00634 00635 if (MakeInfoStringPRC(ConTbl, lpModeInfo) ) { 00636 ConsoleImeSendMessage( ConTbl->hWndCon, 00637 (WPARAM)hwnd, 00638 (LPARAM)&CopyData 00639 ); 00640 } 00641 } 00642 else if (CompFlag & GCS_RESULTSTR) 00643 { 00644 // 00645 // Reads in the result string. 00646 // 00647 ImmGetCompositionString( hIMC, GCS_RESULTSTR, TempBuf, dwBufLen ); 00648 00649 // 00650 // Null terminated. 00651 // 00652 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00653 00654 lpCompStrMem->dwResultStrLen = dwBufLen; 00655 if (lpCompStrMem->dwResultStrLen) 00656 lpCompStrMem->dwResultStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00657 // 00658 // send character to Console 00659 // 00660 CopyData.dwData = CI_CONIMECOMPOSITION; 00661 CopyData.cbData = lpCompStrMem->dwSize; 00662 CopyData.lpData = lpCompStrMem; 00663 ConsoleImeSendMessage( ConTbl->hWndCon, 00664 (WPARAM)hwnd, 00665 (LPARAM)&CopyData 00666 ); 00667 00668 } 00669 else if (CompFlag == 0) 00670 { 00671 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00672 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00673 lpCompStrMem->dwResultStrLen = dwBufLen; 00674 lpCompStrMem->dwCompStrLen = dwBufLen; 00675 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00676 // 00677 // Display character to Console 00678 // 00679 CopyData.dwData = CI_CONIMEMODEINFO; 00680 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 00681 CopyData.lpData = lpModeInfo; 00682 00683 if (MakeInfoStringPRC(ConTbl, lpModeInfo) ) { 00684 ConsoleImeSendMessage( ConTbl->hWndCon, 00685 (WPARAM)hwnd, 00686 (LPARAM)&CopyData 00687 ); 00688 } 00689 } 00690 00691 00692 LocalFree( lpModeInfo ); 00693 00694 ImmReleaseContext( hwnd, hIMC ); 00695 return; 00696 00697 }

void GetCompStrTaiwan HWND  hwnd,
PCONSOLE_TABLE  ConTbl,
LPARAM  CompFlag
 

Definition at line 272 of file country3.c.

References BYTE, CI_CONIMECOMPOSITION, CI_CONIMEMODEINFO, _CONSOLE_TABLE::CompAttrColor, _CONIME_UICOMPMESSAGE::CompAttrColor, CONIME_UIMODEINFO, ConsoleImeSendMessage(), DBGPRINT, _CONIME_UICOMPMESSAGE::dwCompAttrLen, _CONIME_UICOMPMESSAGE::dwCompAttrOffset, _CONIME_UICOMPMESSAGE::dwCompStrLen, _CONIME_UICOMPMESSAGE::dwCompStrOffset, DWORD, _CONIME_UICOMPMESSAGE::dwResultStrLen, _CONIME_UICOMPMESSAGE::dwResultStrOffset, _CONIME_UICOMPMESSAGE::dwSize, FAR, _CONSOLE_TABLE::hWndCon, ImmGetContext(), ImmReleaseContext(), _CONSOLE_TABLE::lpCompStrMem, MakeInfoStringTaiwan(), NULL, and UINT.

Referenced by GetCompositionStr().

00277 { 00278 HIMC hIMC; // Input context handle. 00279 DWORD dwBufLen; // Stogare for len. of composition str 00280 DWORD dwBufLenAttr; 00281 DWORD SizeToAlloc; 00282 PWCHAR TempBuf; 00283 PUCHAR TempBufA; 00284 DWORD i; 00285 DWORD CursorPos; 00286 COPYDATASTRUCT CopyData; 00287 LPCONIME_UIMODEINFO lpModeInfo; 00288 LPCONIME_UICOMPMESSAGE lpCompStrMem; 00289 00290 // 00291 // If fail to get input context handle then do nothing. 00292 // Applications should call ImmGetContext API to get 00293 // input context handle. 00294 // 00295 hIMC = ImmGetContext( hwnd ); 00296 if ( hIMC == 0 ) 00297 return; 00298 00299 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ); 00300 if ( lpModeInfo == NULL) { 00301 ImmReleaseContext( hwnd, hIMC ); 00302 return; 00303 } 00304 00305 if (CompFlag & GCS_COMPSTR) 00306 { 00307 // 00308 // Determines how much memory space to store the composition string. 00309 // Applications should call ImmGetCompositionString with 00310 // GCS_COMPSTR flag on, buffer length zero, to get the bullfer 00311 // length. 00312 // 00313 dwBufLen = ImmGetCompositionString( hIMC, GCS_COMPSTR, (void FAR*)NULL, 0l ); 00314 if ( dwBufLen < 0 ) { 00315 ImmReleaseContext( hwnd, hIMC ); 00316 return; 00317 } 00318 if ( CompFlag & GCS_COMPATTR ) 00319 { 00320 DBGPRINT((" GCS_COMPATTR\n")); 00321 dwBufLenAttr = ImmGetCompositionString( hIMC, GCS_COMPATTR,( void FAR *)NULL, 0l ); 00322 if ( dwBufLenAttr < 0 ) { 00323 dwBufLenAttr = 0; 00324 } 00325 } 00326 else { 00327 dwBufLenAttr = 0; 00328 } 00329 } 00330 else if (CompFlag & GCS_RESULTSTR) 00331 { 00332 // 00333 // Determines how much memory space to store the result string. 00334 // Applications should call ImmGetCompositionString with 00335 // GCS_RESULTSTR flag on, buffer length zero, to get the bullfer 00336 // length. 00337 // 00338 dwBufLen = ImmGetCompositionString( hIMC, GCS_RESULTSTR, (void FAR *)NULL, 0l ); 00339 if ( dwBufLen < 0 ) { 00340 ImmReleaseContext( hwnd, hIMC ); 00341 return; 00342 } 00343 dwBufLenAttr = 0; 00344 } 00345 else if (CompFlag == 0) 00346 { 00347 dwBufLen = 0; 00348 dwBufLenAttr = 0; 00349 } 00350 00351 SizeToAlloc = (UINT)( sizeof(CONIME_UICOMPMESSAGE) + 00352 dwBufLen + sizeof(WCHAR) + 00353 dwBufLenAttr + sizeof(BYTE) ); 00354 00355 if ( ConTbl->lpCompStrMem != NULL && 00356 SizeToAlloc > ConTbl->lpCompStrMem->dwSize 00357 ) 00358 { 00359 LocalFree( ConTbl->lpCompStrMem ); 00360 ConTbl->lpCompStrMem = NULL; 00361 } 00362 00363 if (ConTbl->lpCompStrMem == NULL) { 00364 ConTbl->lpCompStrMem = (LPCONIME_UICOMPMESSAGE)LocalAlloc(LPTR, SizeToAlloc ); 00365 if ( ConTbl->lpCompStrMem == NULL) { 00366 ImmReleaseContext( hwnd, hIMC ); 00367 return; 00368 } 00369 ConTbl->lpCompStrMem->dwSize = SizeToAlloc; 00370 } 00371 00372 lpCompStrMem = ConTbl->lpCompStrMem; 00373 RtlZeroMemory(&lpCompStrMem->dwCompAttrLen, 00374 lpCompStrMem->dwSize - sizeof(lpCompStrMem->dwSize) 00375 ); 00376 00377 TempBuf = (PWCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE)); 00378 TempBufA = (PUCHAR)((PUCHAR)lpCompStrMem + sizeof(CONIME_UICOMPMESSAGE) + 00379 dwBufLen + sizeof(WCHAR)); 00380 00381 CopyMemory(lpCompStrMem->CompAttrColor , ConTbl->CompAttrColor , 8 * sizeof(WCHAR)); 00382 00383 if (CompFlag & GCS_COMPSTR) 00384 { 00385 // 00386 // Reads in the composition string. 00387 // 00388 ImmGetCompositionString( hIMC, GCS_COMPSTR, TempBuf, dwBufLen ); 00389 00390 // 00391 // Null terminated. 00392 // 00393 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00394 00395 // 00396 // If GCS_COMPATTR flag is on, then we need to take care of it. 00397 // 00398 if ( dwBufLenAttr != 0 ) 00399 { 00400 ImmGetCompositionString( hIMC, 00401 GCS_COMPATTR, 00402 TempBufA, 00403 dwBufLenAttr ); 00404 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00405 } 00406 00407 lpCompStrMem->dwCompStrLen = dwBufLen; 00408 if (lpCompStrMem->dwCompStrLen) 00409 lpCompStrMem->dwCompStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00410 00411 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00412 if (lpCompStrMem->dwCompAttrLen) 00413 lpCompStrMem->dwCompAttrOffset = sizeof(CONIME_UICOMPMESSAGE) + dwBufLen + sizeof(WCHAR); 00414 // 00415 // Display character to Console 00416 // 00417 CopyData.dwData = CI_CONIMEMODEINFO; 00418 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 00419 CopyData.lpData = lpModeInfo; 00420 00421 if (MakeInfoStringTaiwan(ConTbl, lpModeInfo) ) { 00422 ConsoleImeSendMessage( ConTbl->hWndCon, 00423 (WPARAM)hwnd, 00424 (LPARAM)&CopyData 00425 ); 00426 } 00427 } 00428 else if (CompFlag & GCS_RESULTSTR) 00429 { 00430 // 00431 // Reads in the result string. 00432 // 00433 ImmGetCompositionString( hIMC, GCS_RESULTSTR, TempBuf, dwBufLen ); 00434 00435 // 00436 // Null terminated. 00437 // 00438 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00439 00440 lpCompStrMem->dwResultStrLen = dwBufLen; 00441 if (lpCompStrMem->dwResultStrLen) 00442 lpCompStrMem->dwResultStrOffset = sizeof(CONIME_UICOMPMESSAGE); 00443 // 00444 // send character to Console 00445 // 00446 CopyData.dwData = CI_CONIMECOMPOSITION; 00447 CopyData.cbData = lpCompStrMem->dwSize; 00448 CopyData.lpData = lpCompStrMem; 00449 ConsoleImeSendMessage( ConTbl->hWndCon, 00450 (WPARAM)hwnd, 00451 (LPARAM)&CopyData 00452 ); 00453 00454 } 00455 else if (CompFlag == 0) 00456 { 00457 TempBuf[ dwBufLen / sizeof(WCHAR) ] = TEXT('\0'); 00458 TempBufA[ dwBufLenAttr ] = (BYTE)0; 00459 lpCompStrMem->dwResultStrLen = dwBufLen; 00460 lpCompStrMem->dwCompStrLen = dwBufLen; 00461 lpCompStrMem->dwCompAttrLen = dwBufLenAttr; 00462 // 00463 // Display character to Console 00464 // 00465 CopyData.dwData = CI_CONIMEMODEINFO; 00466 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 00467 CopyData.lpData = lpModeInfo; 00468 00469 if (MakeInfoStringTaiwan(ConTbl, lpModeInfo) ) { 00470 ConsoleImeSendMessage( ConTbl->hWndCon, 00471 (WPARAM)hwnd, 00472 (LPARAM)&CopyData 00473 ); 00474 } 00475 } 00476 00477 00478 LocalFree( lpModeInfo ); 00479 00480 ImmReleaseContext( hwnd, hIMC ); 00481 return; 00482 00483 }

VOID ReDisplayCompositionStr HWND  hwnd  ) 
 

Definition at line 928 of file country3.c.

References DBGPRINT, _CONSOLE_TABLE::fInComposition, HKL_TO_LANGID, _CONSOLE_TABLE::hklActive, LANG_ID_JAPAN, LANG_ID_KOREA, LANG_ID_PRC, LANG_ID_TAIWAN, LastConsole, NULL, ReDisplayCompStrJapan(), ReDisplayCompStrKorea(), ReDisplayCompStrPRC(), ReDisplayCompStrTaiwan(), and SearchConsole().

Referenced by ConsoleSetFocus().

00931 { 00932 PCONSOLE_TABLE ConTbl; 00933 00934 ConTbl = SearchConsole(LastConsole); 00935 if (ConTbl == NULL) { 00936 DBGPRINT(("CONIME: Error! Cannot found registed Console\n")); 00937 return; 00938 } 00939 00940 if (! ConTbl->fInComposition) 00941 return; 00942 00943 switch ( HKL_TO_LANGID(ConTbl->hklActive)) 00944 { 00945 case LANG_ID_JAPAN: 00946 ReDisplayCompStrJapan(hwnd, ConTbl); 00947 break; 00948 case LANG_ID_TAIWAN: 00949 ReDisplayCompStrTaiwan(hwnd, ConTbl); 00950 break; 00951 case LANG_ID_PRC: 00952 ReDisplayCompStrPRC(hwnd, ConTbl); 00953 break; 00954 case LANG_ID_KOREA: 00955 ReDisplayCompStrKorea(hwnd, ConTbl); 00956 break; 00957 default: 00958 break; 00959 } 00960 return; 00961 }

VOID ReDisplayCompStrJapan HWND  hwnd,
PCONSOLE_TABLE  ConTbl
 

Definition at line 964 of file country3.c.

References CI_CONIMECOMPOSITION, ConsoleImeSendMessage(), _CONIME_UICOMPMESSAGE::dwSize, _CONSOLE_TABLE::hWndCon, and _CONSOLE_TABLE::lpCompStrMem.

Referenced by ReDisplayCompositionStr().

00968 { 00969 COPYDATASTRUCT CopyData; 00970 LPCONIME_UICOMPMESSAGE lpCompStrMem; 00971 00972 lpCompStrMem = ConTbl->lpCompStrMem; 00973 CopyData.dwData = CI_CONIMECOMPOSITION; 00974 CopyData.cbData = lpCompStrMem->dwSize; 00975 CopyData.lpData = lpCompStrMem; 00976 ConsoleImeSendMessage( ConTbl->hWndCon, 00977 (WPARAM)hwnd, 00978 (LPARAM)&CopyData 00979 ); 00980 }

VOID ReDisplayCompStrKorea HWND  hwnd,
PCONSOLE_TABLE  ConTbl
 

Definition at line 1042 of file country3.c.

References CI_CONIMECOMPOSITION, ConsoleImeSendMessage(), _CONIME_UICOMPMESSAGE::dwSize, _CONSOLE_TABLE::hWndCon, and _CONSOLE_TABLE::lpCompStrMem.

Referenced by ReDisplayCompositionStr().

01046 { 01047 01048 COPYDATASTRUCT CopyData; 01049 LPCONIME_UICOMPMESSAGE lpCompStrMem; 01050 01051 lpCompStrMem = ConTbl->lpCompStrMem; 01052 CopyData.dwData = CI_CONIMECOMPOSITION; 01053 CopyData.cbData = lpCompStrMem->dwSize; 01054 CopyData.lpData = lpCompStrMem; 01055 ConsoleImeSendMessage( ConTbl->hWndCon, 01056 (WPARAM)hwnd, 01057 (LPARAM)&CopyData 01058 ); 01059 01060 }

VOID ReDisplayCompStrPRC HWND  hwnd,
PCONSOLE_TABLE  ConTbl
 

Definition at line 1013 of file country3.c.

References CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), _CONSOLE_TABLE::hWndCon, MakeInfoStringPRC(), and NULL.

Referenced by ReDisplayCompositionStr().

01017 { 01018 COPYDATASTRUCT CopyData; 01019 LPCONIME_UIMODEINFO lpModeInfo; 01020 01021 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ); 01022 if ( lpModeInfo == NULL) { 01023 return; 01024 } 01025 // 01026 // Display character to Console 01027 // 01028 CopyData.dwData = CI_CONIMEMODEINFO; 01029 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 01030 CopyData.lpData = lpModeInfo; 01031 01032 if (MakeInfoStringPRC(ConTbl, lpModeInfo) ) { 01033 ConsoleImeSendMessage( ConTbl->hWndCon, 01034 (WPARAM)hwnd, 01035 (LPARAM)&CopyData 01036 ); 01037 } 01038 LocalFree( lpModeInfo ); 01039 }

VOID ReDisplayCompStrTaiwan HWND  hwnd,
PCONSOLE_TABLE  ConTbl
 

Definition at line 983 of file country3.c.

References CI_CONIMEMODEINFO, CONIME_UIMODEINFO, ConsoleImeSendMessage(), _CONSOLE_TABLE::hWndCon, MakeInfoStringTaiwan(), and NULL.

Referenced by ReDisplayCompositionStr().

00987 { 00988 COPYDATASTRUCT CopyData; 00989 LPCONIME_UIMODEINFO lpModeInfo; 00990 00991 lpModeInfo = (LPCONIME_UIMODEINFO)LocalAlloc(LPTR, sizeof(CONIME_UIMODEINFO) ); 00992 if ( lpModeInfo == NULL) { 00993 return; 00994 } 00995 // 00996 // Display character to Console 00997 // 00998 CopyData.dwData = CI_CONIMEMODEINFO; 00999 CopyData.cbData = sizeof(CONIME_UIMODEINFO); 01000 CopyData.lpData = lpModeInfo; 01001 01002 if (MakeInfoStringTaiwan(ConTbl, lpModeInfo) ) { 01003 ConsoleImeSendMessage( ConTbl->hWndCon, 01004 (WPARAM)hwnd, 01005 (LPARAM)&CopyData 01006 ); 01007 } 01008 01009 LocalFree( lpModeInfo ); 01010 }


Generated on Sat May 15 19:43:17 2004 for test by doxygen 1.3.7