uicomp.c
上传用户:szljw888
上传日期:2010-04-11
资源大小:124k
文件大小:16k
源码类别:

输入法编程

开发平台:

C/C++

  1. /* 大熊猫输入法(Free Chinese Input)  由YJMSIR(yjmsir@163.com)编写
  2.  * 协议: GPL
  3.  * freeinput( A Chinese Input Method) by YJMSIR(yjmsir@163.com)
  4.  * Licence: GPL 
  5.  */
  6. #include "freepy.h"
  7. static HBITMAP hBmpComp;//,hBmp_forward,hBmp_next
  8. static int NoCompStrYjm=0;
  9. void UpdateCompBackBmp()
  10. {
  11. if(!IsFileExist(szStatusFileName)||
  12.    !(hBmpComp = (HBITMAP)LoadImage(NULL, szCompFileName,
  13. IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION))){
  14. Add(InstallFromDir,_T("background\leaf.bmp"),szCompFileName);
  15. hBmpComp = (HBITMAP)LoadImage(NULL, szCompFileName,
  16. IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_CREATEDIBSECTION);
  17. }
  18. }
  19. LRESULT WINAPI CompWndProc(
  20. HWND   hWnd,
  21. UINT   message,
  22. WPARAM wParam,
  23. LPARAM lParam)
  24. {
  25. HWND  hUIWnd;
  26.     HGLOBAL hUIExtra;
  27.     LPUIEXTRA lpUIExtra;
  28. hUIWnd = (HWND)GetWindowLong(hWnd,FIGWL_SVRWND);
  29.     hUIExtra = (HGLOBAL)GetWindowLong(hUIWnd,IMMGWL_PRIVATE);
  30. lpUIExtra = (LPUIEXTRA)GlobalLock(hUIExtra);
  31.     switch (message)
  32.     {
  33.         case WM_PAINT:
  34. //DebugLog(8,(DebugLogFile,"WM_PAINTn"));
  35. //MessageBox(NULL,"have paint","hCompWnd",MB_OK);
  36. //hBmp_forward = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_forward));
  37. //hBmp_next = LoadBitmap(hInst,MAKEINTRESOURCE(IDB_next));
  38. PaintCompWindow(hWnd);
  39.             break;
  40.         case WM_SETCURSOR:
  41.         case WM_MOUSEMOVE:
  42.         case WM_LBUTTONUP:
  43.         case WM_RBUTTONUP:
  44.             //DragUI(hWnd,lpUIExtra->uiCand.hWnd,message,wParam,lParam,TRUE);
  45.             if ((message == WM_SETCURSOR) &&
  46.                 (HIWORD(lParam) != WM_LBUTTONDOWN) &&
  47.                 (HIWORD(lParam) != WM_RBUTTONDOWN)) 
  48.                 return DefWindowProc(hWnd,message,wParam,lParam);
  49.             if ((message == WM_LBUTTONUP) || (message == WM_RBUTTONUP))
  50.                 SetWindowLong(hWnd,FIGWL_MOUSE,0L);
  51.             break;
  52.         case WM_DESTROY:
  53.             DeleteObject(hBmpComp);
  54.             break;
  55.         default:
  56.             if (!MyIsIMEMessage(message)) {
  57. GlobalUnlock(hUIExtra);
  58.                 return DefWindowProc(hWnd,message,wParam,lParam);
  59. }
  60.             break;
  61.     }
  62.     GlobalUnlock(hUIExtra);
  63.     return 0;
  64. }
  65. void CreateCompWindow( HWND hUIWnd, LPUIEXTRA lpUIExtra)
  66. {
  67. UpdateCompBackBmp();
  68.     if (!IsWindow(lpUIExtra->uiComp.hWnd))
  69.     {
  70. HDC hDC;
  71. HFONT oldFont;
  72. SIZE sz;
  73. TCHAR szStr[100];
  74. RECT screenrc;
  75. SystemParametersInfo(SPI_GETWORKAREA,
  76. 0,
  77. &screenrc,
  78. 0);
  79. lpUIExtra->uiComp.hWnd = 
  80.         //    CreateWindowEx( WS_EX_WINDOWEDGE,//WS_EX_TOPMOST
  81.                       CreateWindowEx( 0,
  82.                          COMPCLASSNAME,NULL,
  83.                          WS_DISABLED |WS_POPUP, 
  84.                          //lpUIExtra->uiComp.pt.x,
  85.                          //lpUIExtra->uiComp.pt.y,
  86.  screenrc.left+20,
  87.  screenrc.bottom -1,
  88.                          21,
  89.  11,
  90.                          hUIWnd,NULL,hInst,NULL);
  91. SetWindowLong(lpUIExtra->uiComp.hWnd,FIGWL_SVRWND,(DWORD)hUIWnd);
  92. hDC = GetDC(lpUIExtra->uiComp.hWnd);
  93. oldFont = SelectObject(hDC, hUIFont);
  94. _stprintf(szStr,_T("A"));
  95. GetTextExtentPoint(hDC,szStr,1,&sz);
  96. _stprintf(szStr,_T("AAAAAAAAAAAAA"));
  97. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),sizeCand);
  98. _stprintf(szStr,_T("<< 1啊 2啊 3啊 4啊 5啊 6啊 7啊 8啊 9啊 0啊 >>"));
  99. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),sizeCand+1);
  100. SelectObject(hDC, oldFont);
  101. ReleaseDC(lpUIExtra->uiComp.hWnd,hDC);
  102. lpUIExtra->uiComp.sz.cx = sz.cx*20;
  103. lpUIExtra->uiComp.sz.cy = sz.cy+4;
  104.     }
  105. //ShowWindow(lpUIExtra->uiComp.hWnd,SW_HIDE);
  106. //DebugLog(8,(DebugLogFile,"CreateCompWindown"));
  107. ShowWindow(lpUIExtra->uiComp.hWnd, SW_SHOWNOACTIVATE);
  108. InvalidateRect(lpUIExtra->uiComp.hWnd,NULL,FALSE);
  109.     return;
  110. }
  111. void MoveCompWindow( HWND hUIWnd, LPUIEXTRA lpUIExtra, LPINPUTCONTEXT lpIMC)
  112. {
  113. //DebugLog(8,(DebugLogFile,"MoveCompWindown"));
  114. if (!IsWindow(lpUIExtra->uiComp.hWnd)){
  115. CreateCompWindow( hUIWnd, lpUIExtra);
  116. //DebugLog(8,(DebugLogFile,"MoveCompWindown"));
  117. }
  118. if (IsWindow(lpUIExtra->uiComp.hWnd))
  119. {
  120. HDC hDC;
  121. HFONT oldFont;
  122. LPCOMPOSITIONSTRING lpCompStr;
  123.     LPCANDIDATEINFO lpCandInfo;
  124.     LPCANDIDATELIST lpCandList;
  125. POINT pt;
  126. RECT screenrc;
  127. LPTSTR lpStr;
  128. SIZE sz;
  129.     int height;
  130. int width,maxcomplen;
  131. //DebugLog(8,(DebugLogFile,"IsWindown"));
  132. if(wConversionSet1 & C_SET1_SINGLELINE)
  133. height=lpUIExtra->uiComp.sz.cy+3;
  134. else height=lpUIExtra->uiComp.sz.cy*2+6;
  135. if(wConversionSet & CONVERSION_SET_HISTORYREUSE||wConversionSet1 & C_SET1_Word_Existed_Hint)
  136. if(_tcslen(YJMMessage))
  137. maxcomplen=sizeCand[0].cx;
  138. else maxcomplen=0;
  139. sz.cx = 0;
  140. sz.cy = 0;
  141. if (lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr))
  142. {
  143. if ((lpCompStr->dwSize > sizeof(COMPOSITIONSTRING))
  144. && (lpCompStr->dwCompStrLen > 0))
  145. {
  146. lpStr =((LPMYCOMPSTR)lpCompStr)->FreePYComp.szPaintCompStr;
  147. hDC = GetDC(lpUIExtra->uiComp.hWnd);
  148. oldFont = SelectObject(hDC, hUIFont);
  149. GetTextExtentPoint(hDC,lpStr,_tcslen(lpStr),&sz);
  150. SelectObject(hDC, oldFont);
  151. ReleaseDC(lpUIExtra->uiComp.hWnd,hDC);
  152. if(_tcslen(lpStr)) sz.cx += 2*sz.cx/_tcslen(lpStr);
  153. ImmUnlockIMCC(lpIMC->hCompStr);
  154. maxcomplen=max(sz.cx,lpUIExtra->uiComp.sz.cx);
  155. NoCompStrYjm=0;
  156. }
  157. else{
  158. NoCompStrYjm=1;
  159. /* if(wConversionSet & CONVERSION_SET_AUTOHIDE)
  160. ShowWindow(lpUIExtra->uiComp.hWnd, SW_HIDE);
  161. else{
  162. ShowWindow(lpUIExtra->uiComp.hWnd, SW_SHOWNOACTIVATE);
  163. InvalidateRect(lpUIExtra->uiComp.hWnd,NULL,FALSE);
  164. }
  165. ImmUnlockIMCC(lpIMC->hCompStr);
  166. return;*/
  167. }
  168. }
  169. if (lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(lpIMC->hCandInfo))
  170. {
  171. TCHAR szStr[10*MAXSTRHZLENGTH];
  172. DWORD i;
  173. DWORD dwMaxPaintPos;
  174. WORD  wCount;
  175. LPTSTR lpstr;
  176. width = 2;
  177. lpCandList = (LPCANDIDATELIST)((LPSTR)lpCandInfo  + lpCandInfo->dwOffset[0]);
  178. if( lpCandList->dwCount <= 0 && NoCompStrYjm) {
  179. ShowWindow(lpUIExtra->uiComp.hWnd, SW_HIDE);
  180. ImmUnlockIMCC(lpIMC->hCandInfo);
  181. return;
  182. }
  183. //hDC = GetDC(lpUIExtra->uiCand.hWnd);
  184. hDC = GetDC(lpUIExtra->uiComp.hWnd);
  185. oldFont = SelectObject(hDC, hUIFont);
  186. if(wConversionSet1 & C_SET1_SINGLELINE) {
  187. width +=maxcomplen;
  188. lpstr = GETLPCANDSTR(lpCandList,0);
  189. GetTextExtentPoint(hDC,lpstr,_tcslen(lpstr),&sz);
  190. if(_tcslen(lpstr)) width +=sz.cx*3/2;
  191. }
  192. else if(wConversionSet & CONVERSION_SET_SHAPE) {
  193. lpstr = GETLPCANDSTR(lpCandList,0);
  194. if(_tcslen(lpstr)) width += 30;//sz.cx*3/2;
  195. }
  196. dwMaxPaintPos = lpCandList->dwPageStart +lpCandList->dwPageSize ;
  197. if(dwMaxPaintPos > lpCandList->dwCount + 2)  dwMaxPaintPos = lpCandList->dwCount + 2;
  198. wCount = 0;
  199. for (i = lpCandList->dwPageStart; i < dwMaxPaintPos; i++)
  200. {
  201. wCount++;
  202. lpstr = GETLPCANDSTR(lpCandList,i);
  203. GetTextExtentPoint(hDC,lpstr,_tcslen(lpstr),&sz);
  204. if(wConversionSet1 & C_SET1_SINGLELINE) {//单行
  205. _stprintf(szStr,"%d%s ",wCount%10,lpstr);
  206. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  207. width += sz.cx;
  208. }
  209. else if(wConversionSet & CONVERSION_SET_SHAPE) {//双行
  210. if((wConversionMode==CONVERSION_MODE_WUBI|| wConversionMode==CONVERSION_MODE_ATTACHLIB|| wConversionMode==CONVERSION_MODE_TEMPATTACHLIB)&&
  211. i<12 && wConversionSet1 & C_SET1_CODE_HINT)
  212. _stprintf(szStr,"%d%s%s ",wCount%10,lpstr,CodeHintText[i-2]);
  213. else
  214. _stprintf(szStr,"%d%s ",wCount%10,lpstr);
  215. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  216. width += sz.cx;
  217. }
  218. else {
  219. _stprintf(szStr,"%d %s ",wCount%10,lpstr);//多行
  220. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  221. height += sz.cy;
  222. width=max(width,sz.cx);
  223. }
  224. }
  225. if(wConversionSet1 & C_SET1_SINGLELINE) {
  226. lpstr = GETLPCANDSTR(lpCandList,1);
  227. if(_tcslen(lpstr)) {
  228. GetTextExtentPoint(hDC,"A",1,&sz);
  229. width += sz.cx*3/2;
  230. }
  231. }
  232. else if(wConversionSet & CONVERSION_SET_SHAPE) {
  233. lpstr = GETLPCANDSTR(lpCandList,1);
  234. if(_tcslen(lpstr)) {
  235. //GetTextExtentPoint(hDC,"A",1,&sz);
  236. width +=30;// sz.cx*3/2;
  237. }
  238. }
  239. SelectObject(hDC, oldFont);
  240. //ReleaseDC(lpUIExtra->uiCand.hWnd,hDC);
  241. ReleaseDC(lpUIExtra->uiComp.hWnd,hDC);
  242. ImmUnlockIMCC(lpIMC->hCandInfo);
  243. }
  244. sz.cx =max(maxcomplen,width);
  245. sz.cy = height;
  246. if(lpUIExtra->uiComp.pt.x < 0) {
  247. pt.x = 15;
  248. pt.y = 15;
  249. ClientToScreen(lpIMC->hWnd, &pt);
  250. }
  251. else{
  252. pt.x = lpUIExtra->uiComp.pt.x;
  253. pt.y = lpUIExtra->uiComp.pt.y;
  254. }
  255. SystemParametersInfo(SPI_GETWORKAREA,
  256. 0,
  257. &screenrc,
  258. 0);
  259. //DebugLog(8,(DebugLogFile,"screenrc.x=%d,screenrc.y=%dn",screenrc.right,screenrc.bottom));
  260. if( (pt.x + sz.cx) > screenrc.right )
  261. pt.x = screenrc.right - sz.cx;
  262. if( (pt.y + sz.cy) > screenrc.bottom )
  263. pt.y = screenrc.bottom - sz.cy;
  264. //DebugLog(8,(DebugLogFile,"pt.x=%d,pt.y=%dn",pt.x,pt.y));
  265. MoveWindow(lpUIExtra->uiComp.hWnd,
  266. pt.x,
  267. pt.y,
  268. sz.cx,
  269. sz.cy,
  270. TRUE);
  271. ShowWindow(lpUIExtra->uiComp.hWnd, SW_SHOWNOACTIVATE);
  272. InvalidateRect(lpUIExtra->uiComp.hWnd,NULL,FALSE);
  273. }
  274. }
  275. void PaintCompWindow( HWND hCompWnd)
  276. {
  277.     PAINTSTRUCT ps;
  278.     HIMC hIMC;
  279.     LPINPUTCONTEXT lpIMC;
  280.     LPCOMPOSITIONSTRING lpCompStr;
  281.     LPCANDIDATEINFO lpCandInfo;
  282.     LPCANDIDATELIST lpCandList;
  283.     HDC hDC;
  284.     HDC hMemDC;
  285.     HBITMAP hBmpOld;
  286. HFONT oldFont;
  287.     int height=2,width=2;
  288. RECT rc;
  289.     HWND hSvrWnd;
  290. HBRUSH hBrush = (HBRUSH)NULL;
  291. HBRUSH hOldBrush = (HBRUSH)NULL;
  292. HPEN hPen = (HPEN)NULL;
  293. HPEN hOldPen = (HPEN)NULL;
  294. //DebugLog(8,(DebugLogFile,"PaintCompWindown"));
  295. //MessageBox(NULL,"have paint","hCompWnd",MB_OK);
  296.     hDC = BeginPaint(hCompWnd,&ps);
  297. oldFont = SelectObject(hDC, hUIFont);
  298.     hMemDC = CreateCompatibleDC(hDC);
  299.     hBmpOld = SelectObject(hMemDC,hBmpStatus);
  300. GetClientRect(hCompWnd,&rc);
  301. if(wConversionSet &CONVERSION_SET_BACKBMP)
  302. hBrush = CreatePatternBrush(hBmpComp);
  303. else
  304. hBrush =CreateSolidBrush(dwBackColor&0xffffff);
  305. hOldBrush=SelectObject(hDC,hBrush);
  306. hPen = CreatePen(PS_SOLID ,0,dwPenColor&0xffffff);
  307. hOldPen = SelectObject(hDC,hPen);
  308. if(wConversionSet1 & C_SET1_RECTANGLEWINDOW)
  309. Rectangle(hDC,
  310. rc.left,
  311. rc.top,
  312. rc.right,
  313. rc.bottom);
  314. else
  315. RoundRect(hDC,
  316. rc.left,
  317. rc.top,
  318. rc.right,
  319. rc.bottom,10,10);
  320. SelectObject(hDC,hOldPen);
  321. DeleteObject(hPen);
  322. if(hBrush && hOldBrush)
  323. SelectObject(hDC,hOldBrush);
  324.     hSvrWnd = (HWND)GetWindowLong(hCompWnd,FIGWL_SVRWND);
  325.     if (hIMC = (HIMC)GetWindowLong(hSvrWnd,IMMGWL_IMC))
  326.     {
  327. if( (lpIMC = ImmLockIMC(hIMC)) == NULL ){
  328. SelectObject(hDC, oldFont);
  329. EndPaint(hCompWnd,&ps);
  330. //MessageBox(NULL,"no lpIMC","hCompWnd",MB_OK);
  331. return;
  332. }
  333.         if (lpCompStr = (LPCOMPOSITIONSTRING)ImmLockIMCC(lpIMC->hCompStr))
  334.         {
  335.             if ((lpCompStr->dwSize > sizeof(COMPOSITIONSTRING))
  336.                && (lpCompStr->dwCompStrLen > 0))
  337.             {
  338.                 LPTSTR lpStr,lpPaintStr;
  339. SIZE sz,sz1,sz2;
  340. SHORT wEditCaret;
  341. SHORT wCharNum,wCount;
  342. int i;
  343. wEditCaret = ((LPMYCOMPSTR)lpCompStr)->FreePYComp.wEditCaret;
  344. lpStr = GETLPCOMPSTR(lpCompStr);
  345. lpPaintStr = 
  346. ((LPMYCOMPSTR)lpCompStr)->FreePYComp.szPaintCompStr;
  347. SetBkMode(hDC,TRANSPARENT);
  348. SetPaintColor(hDC, (WORD)wConversionMode);
  349. TextOut(hDC,2,2,lpPaintStr,_tcslen(lpPaintStr));
  350. if(wConversionMode == CONVERSION_MODE_WUBI){
  351. GetTextExtentPoint(hDC,lpStr,_tcslen(lpStr),&sz);
  352. }
  353. else{
  354. wCharNum = _tcslen(lpStr) - wEditCaret;
  355. wCount = 0;
  356. for(i = _tcslen(lpPaintStr);i;i--) {
  357. if(wCount == wCharNum) break;
  358. if( *(lpPaintStr + i -1 ) != _T(' ')) wCount++;
  359. }
  360. GetTextExtentPoint(hDC,lpPaintStr,i,&sz);
  361. }
  362. GetTextExtentPoint(hDC,"A",1,&sz1);
  363. GetTextExtentPoint(hDC,lpPaintStr,_tcslen(lpPaintStr),&sz2);
  364. if(_tcslen(lpPaintStr)) sz2.cx += 2*sz1.cx;
  365. width=max(sz2.cx,sz1.cx*4);
  366. height=6+sz1.cy;
  367. //以下画光标
  368. hPen = CreatePen(PS_SOLID,3,RGB(0,0,0));
  369. hOldPen = SelectObject(hDC,hPen);
  370. MoveToEx(hDC,sz.cx + sz1.cx/4,sz1.cy*11/10,NULL);
  371. LineTo(hDC,sz.cx + sz1.cx*2/3,sz1.cy*11/10);
  372. SelectObject(hDC,hOldPen);
  373. DeleteObject(hPen);
  374.             }
  375.             ImmUnlockIMCC(lpIMC->hCompStr);
  376.         }
  377. if (lpCandInfo = (LPCANDIDATEINFO)ImmLockIMCC(lpIMC->hCandInfo))
  378. {
  379. DWORD dwMaxPaintPos,i;
  380. TCHAR szStr[10*MAXSTRHZLENGTH];
  381. WORD  wCount;
  382. LPTSTR lpstr;
  383. SIZE sz;
  384. if(wConversionSet1 & C_SET1_SINGLELINE)
  385. height = 2;
  386. else{
  387. //height = 26;
  388. width = 2;
  389. }
  390. lpCandList = (LPCANDIDATELIST)((LPSTR)lpCandInfo  + lpCandInfo->dwOffset[0]);
  391. SetBkMode(hDC,TRANSPARENT);
  392. SetPaintColor(hDC, (WORD)wConversionMode);
  393. //if(wConversionSet1 & C_SET1_SINGLELINE)
  394. if(wConversionSet1 & C_SET1_SINGLELINE) {
  395. lpstr = GETLPCANDSTR(lpCandList,0);
  396. if(_tcslen(lpstr)) {
  397. TextOut(hDC,width,height,lpstr,_tcslen(lpstr));
  398. GetTextExtentPoint(hDC,lpstr,_tcslen(lpstr),&sz);
  399. width += sz.cx*3/2;//30;
  400. }
  401. }
  402. else if(wConversionSet & CONVERSION_SET_SHAPE) {
  403. lpstr = GETLPCANDSTR(lpCandList,0);
  404. //TextOut(hDC,width,height,lpstr,_tcslen(lpstr));
  405. //GetTextExtentPoint(hDC,lpstr,_tcslen(lpstr),&sz);
  406. if(_tcslen(lpstr)) {
  407. BitBlt(hDC,width,height,width+20,height+20,hMemDC,180,0,SRCAND);//SRCCOPY
  408. width += 30;//sz.cx*3/2;
  409. }
  410. }
  411. dwMaxPaintPos = lpCandList->dwPageStart +lpCandList->dwPageSize ;
  412. if(dwMaxPaintPos > lpCandList->dwCount + 2)  dwMaxPaintPos = lpCandList->dwCount + 2;
  413. //if(dwMaxPaintPos > CAND_PAGESIZE + 2)  dwMaxPaintPos = CAND_PAGESIZE + 2;
  414. wCount = 0;
  415. for (i = lpCandList->dwPageStart; i < dwMaxPaintPos; i++)
  416. {
  417. wCount++;
  418. lpstr = GETLPCANDSTR(lpCandList,i);
  419. GetTextExtentPoint(hDC,lpstr,_tcslen(lpstr),&sz);
  420. if(wConversionSet1 & C_SET1_SINGLELINE) {
  421. _stprintf(szStr,"%d%s ",wCount%10,lpstr);
  422. TextOut(hDC,width,height,szStr,_tcslen(szStr));
  423. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  424. width += sz.cx;
  425. }
  426. else if(wConversionSet & CONVERSION_SET_SHAPE) {//双行
  427. if((wConversionMode==CONVERSION_MODE_WUBI|| wConversionMode==CONVERSION_MODE_ATTACHLIB|| wConversionMode==CONVERSION_MODE_TEMPATTACHLIB)&& 
  428. i<12 && wConversionSet1 & C_SET1_CODE_HINT)
  429. _stprintf(szStr,"%d%s%s ",wCount%10,lpstr,CodeHintText[i-2]);
  430. else
  431. _stprintf(szStr,"%d%s ",wCount%10,lpstr);
  432. TextOut(hDC,width,height,szStr,_tcslen(szStr));
  433. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  434. width += sz.cx;
  435. }
  436. else {
  437. _stprintf(szStr,"%d %s ",wCount%10,lpstr);
  438. TextOut(hDC,width,height,szStr,_tcslen(szStr));
  439. GetTextExtentPoint(hDC,szStr,_tcslen(szStr),&sz);
  440. height += sz.cy;
  441. }
  442. }
  443. if(wConversionSet1 & C_SET1_SINGLELINE) {
  444. lpstr = GETLPCANDSTR(lpCandList,1);
  445. if(_tcslen(lpstr)) {
  446. GetTextExtentPoint(hDC,"A",1,&sz);
  447. //width = sizeCand[1].cx -sz.cx*3/2;
  448. TextOut(hDC,width,height,lpstr,_tcslen(lpstr));
  449. //BitBlt(hDC,width,height,width+20,height+20,hMemDC,200,0,SRCCOPY);
  450. }
  451. }
  452. else if(wConversionSet & CONVERSION_SET_SHAPE) {
  453. lpstr = GETLPCANDSTR(lpCandList,1);
  454. if(_tcslen(lpstr)) {
  455. //GetTextExtentPoint(hDC,"A",1,&sz);
  456. //width = sizeCand[1].cx - 30;//sz.cx*3/2;
  457. //TextOut(hDC,width,height,lpstr,_tcslen(lpstr));
  458. BitBlt(hDC,width,height,width+20,height+20,hMemDC,200,0,SRCAND);//SRCCOPY
  459. }
  460. }
  461. ImmUnlockIMCC(lpIMC->hCandInfo);
  462. }
  463.         ImmUnlockIMC(hIMC);
  464.     }
  465. SelectObject(hMemDC,hBmpOld);
  466.     DeleteDC(hMemDC);
  467. SelectObject(hDC, oldFont);
  468.     EndPaint(hCompWnd,&ps);
  469. }
  470. void HideCompWindow(LPUIEXTRA lpUIExtra)
  471. {
  472.     if (IsWindow(lpUIExtra->uiComp.hWnd))
  473.     {
  474.         ShowWindow(lpUIExtra->uiComp.hWnd, SW_HIDE);
  475.     }
  476. }