uistatus.c
上传用户:shdz666
上传日期:2007-01-03
资源大小:566k
文件大小:15k
源码类别:

输入法编程

开发平台:

Visual C++

  1. /*
  2.  * Copyright (C) 1999.4  Li ZhenChun
  3.  *
  4.  * This program is free software; you can redistribute it and/or modify
  5.  * it under the terms of the GNU General Public License as published by
  6.  * the Free Software Foundation; either version 2 of the License; or
  7.  * (at your option) any later version.
  8.  *
  9.  * This program is distributed in the hope that is will be useful, but
  10.  * WITHOUT ANY WARRANTY; without even the implied warranty of 
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12.  * General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU General Public License
  15.  * along with this program; if not, write to the Free Software
  16.  * Foundation, Inc., 675 Mass Ave, Cambridge, M A 02139, USA.
  17.  *
  18.  * Author: Li ZhenChun  email: zhchli@163.net or zhchli@126.com
  19.  * 
  20.  */
  21. #include "freepy.h"
  22. #define HELPFILENAME      _T("freepy.hlp")
  23. #define TIMEID            1
  24. #define TIMEOUT           600
  25. #define BITMAPX           20
  26. #define BITMAPY           20
  27. #define BITMAPCHINESEDES  60
  28. #define BITMAPFULLDES     80
  29. #define BITMAPPUNCTDES    100
  30. #define BITMAPCHINESESRC  60
  31. #define BITMAPFULLSRC     100
  32. #define BITMAPPUNCTSRC    140
  33. #define BUTTONMENU        0x01
  34. #define BUTTONPY          0x02
  35. #define BUTTONCHINESE     0x04
  36. #define BUTTONFULL        0x08
  37. #define BUTTONPUNCT       0x10
  38. #define BUTTONPUSH        0x8000
  39. #define SETFUZZY          0x01
  40. #define SETSORT           0x02
  41. static HBITMAP hBmpStatus;
  42. void PaintStatus( HWND,HDC,DWORD);
  43. DWORD CheckButtonPos( HWND , LPPOINT);
  44. BOOL WINAPI SetDialogProc(HWND,UINT,WPARAM,LPARAM);
  45. BOOL WINAPI AboutDialogProc(HWND,UINT,WPARAM,LPARAM);
  46. LRESULT WINAPI StatusWndProc(
  47. HWND hWnd ,
  48. UINT message ,
  49. WPARAM wParam ,
  50. LPARAM lParam )
  51. {
  52. static BOOL  fCanMove = FALSE;
  53.     static POINT ptdif;
  54.     static RECT  drc;
  55.     static SIZE  sz;
  56. static DWORD dwButton;
  57.     DWORD        dwT;
  58.     POINT        pt;
  59. HDC          hDC;
  60. HKEY         hKey,hChildKey;
  61. DWORD        dwDisposition;
  62. hDC = GetDC(hWnd);
  63.     switch (message)
  64.     {
  65.         case WM_CREATE:
  66.             hBmpStatus = LoadBitmap(hInst,MAKEINTRESOURCE(STATUSBITMAP));
  67.             break;
  68.         case WM_PAINT:
  69. {
  70.     PAINTSTRUCT ps;
  71.     HDC hPaintDC;
  72. hPaintDC = BeginPaint(hWnd,&ps);
  73.         PaintStatus(hWnd ,hPaintDC, 0);
  74. EndPaint(hWnd,&ps);
  75.     break;
  76. }
  77. case WM_TIMER:
  78. KillTimer(hWnd,TIMEID);
  79. SetCursor(LoadCursor(NULL,IDC_SIZEALL));
  80. fCanMove = TRUE;
  81. dwButton &= ~BUTTONPUSH;
  82. PaintStatus(hWnd,hDC,dwButton);
  83. break;
  84.         case WM_SETCURSOR:
  85. if ( HIWORD(lParam) == WM_LBUTTONDOWN ) {
  86. SetCapture(hWnd);
  87. GetCursorPos( &pt );
  88. GetWindowRect(hWnd,&drc);
  89. ptdif.x = pt.x - drc.left;
  90. ptdif.y = pt.y - drc.top;
  91. sz.cx = drc.right - drc.left;
  92. sz.cy = drc.bottom - drc.top;
  93. SetWindowLong(hWnd,FIGWL_MOUSE,FIM_CAPUTURED);
  94. dwButton = CheckButtonPos( hWnd, &pt);
  95. dwButton |= BUTTONPUSH;
  96. PaintStatus(hWnd,hDC,dwButton);
  97. if( dwButton & BUTTONPY)
  98. SetTimer(hWnd,TIMEID,1,NULL);
  99. else
  100. SetTimer(hWnd,TIMEID,TIMEOUT,NULL);
  101. }
  102. else 
  103. return DefWindowProc(hWnd,message,wParam,lParam);
  104. break;
  105.         case WM_LBUTTONUP:
  106. KillTimer(hWnd,TIMEID);
  107. ReleaseCapture();
  108. if( fCanMove ) {
  109. dwT = GetWindowLong(hWnd,FIGWL_MOUSE);
  110. if (dwT & FIM_MOVED) {
  111. DrawUIBorder(&drc);
  112. GetCursorPos( &pt );
  113. MoveWindow(hWnd,pt.x - ptdif.x,
  114. pt.y - ptdif.y,
  115. sz.cx,
  116. sz.cy,TRUE);
  117. }
  118. SetCursor(LoadCursor(NULL,IDC_ARROW));
  119. }
  120. else{
  121. if( dwButton & BUTTONCHINESE ) {
  122.     HWND hSvrWnd;
  123. HIMC hIMC;
  124. LPINPUTCONTEXT lpIMC;
  125. hSvrWnd = (HWND)GetWindowLong(hWnd,FIGWL_SVRWND);
  126. hIMC = (HIMC)GetWindowLong(hSvrWnd,IMMGWL_IMC);
  127.         lpIMC = ImmLockIMC(hIMC);
  128. if(lpIMC->fOpen) {
  129. lpIMC->fOpen=FALSE;
  130. MakeResultString(hIMC,FALSE);
  131. }
  132. else lpIMC->fOpen=TRUE;
  133. }
  134. if( dwButton & BUTTONFULL){
  135. if(wConversionSet & CONVERSION_SET_FULLSHAPE)
  136. wConversionSet &= ~CONVERSION_SET_FULLSHAPE;
  137. else
  138. wConversionSet |= CONVERSION_SET_FULLSHAPE;
  139. }
  140. if( dwButton & BUTTONPUNCT ){
  141. if(wConversionSet & CONVERSION_SET_PUNCT)
  142. wConversionSet &= ~CONVERSION_SET_PUNCT;
  143. else
  144. wConversionSet |= CONVERSION_SET_PUNCT;
  145. }
  146. if( dwButton & BUTTONMENU ){
  147. HMENU hMenu,hSubMenu;
  148. POINT pt;
  149. int cmd;
  150. hMenu = LoadMenu(hInst, MAKEINTRESOURCE(FREEPYMENU));
  151. hSubMenu = GetSubMenu(hMenu,0);
  152.  
  153. pt.x = 0;
  154. pt.y = 0;
  155. ClientToScreen(hWnd, &pt);
  156.                 cmd = TrackPopupMenu(hSubMenu, 
  157.                                      TPM_LEFTALIGN | TPM_BOTTOMALIGN | TPM_RETURNCMD, 
  158.                                      pt.x,
  159.                                      pt.y,
  160.                                      0, 
  161.                                      hWnd, 
  162.                                      NULL);
  163. switch (cmd) {
  164. case IDM_SET:
  165. DialogBox( hInst,MAKEINTRESOURCE(DIALOGSET),NULL,SetDialogProc);
  166. InvalidateRect(hWnd,NULL,FALSE);
  167. break;
  168. case IDM_HELP:
  169. {
  170. TCHAR szHelpFileName[100];
  171. LPTSTR lpHelpFileName;
  172. lpHelpFileName = szHelpFileName;
  173. lpHelpFileName += GetSystemDirectory(szHelpFileName,100);
  174. if (*(lpHelpFileName-1) != _T('\'))
  175. *lpHelpFileName++ = _T('\');
  176. _tcscpy(lpHelpFileName,HELPFILENAME);
  177. WinHelp(NULL,szHelpFileName,HELP_CONTENTS,0);
  178. InvalidateRect(hWnd,NULL,FALSE);
  179. }
  180. break;
  181. case IDM_ABOUT:
  182. DialogBox( hInst,MAKEINTRESOURCE(DIALOGABOUT),NULL,AboutDialogProc);
  183. InvalidateRect(hWnd,NULL,FALSE);
  184. break;
  185. default:
  186. break;
  187. }
  188.             if (hMenu) DestroyMenu(hMenu);
  189. }
  190. dwButton &= ~BUTTONPUSH;
  191. PaintStatus(hWnd,hDC,dwButton);
  192. }
  193. SetWindowLong(hWnd,FIGWL_MOUSE,0);
  194. fCanMove = FALSE;
  195. break;
  196.         
  197.         case WM_MOUSEMOVE:
  198. if( fCanMove ) {
  199. dwT = GetWindowLong(hWnd,FIGWL_MOUSE);
  200. if (dwT & FIM_MOVED) {
  201. DrawUIBorder(&drc);
  202. GetCursorPos( &pt );
  203. drc.left   = pt.x - ptdif.x;
  204. drc.top    = pt.y - ptdif.y;
  205. drc.right  = drc.left + sz.cx;
  206. drc.bottom = drc.top + sz.cy;
  207. DrawUIBorder(&drc);
  208. }
  209. else if (dwT & FIM_CAPUTURED)
  210. {
  211. DrawUIBorder(&drc);
  212. SetWindowLong(hWnd,FIGWL_MOUSE,dwT | FIM_MOVED);
  213. }
  214. }
  215. // else KillTimer(hWnd,TIMEID);
  216. break;
  217.         case WM_DESTROY:
  218.             DeleteObject(hBmpStatus);
  219.             break;
  220. case WM_MOVE:
  221. if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE,
  222. _T("Software"),
  223. 0,
  224. KEY_READ,
  225. &hKey) == ERROR_SUCCESS ){
  226. if( RegCreateKeyEx( hKey,
  227. _T("freepy"),
  228. 0,
  229. NULL,
  230. REG_OPTION_NON_VOLATILE ,
  231. KEY_ALL_ACCESS ,
  232. NULL,
  233. &hChildKey,
  234. &dwDisposition ) == ERROR_SUCCESS) {
  235. RegSetValueEx(hChildKey,
  236. _T("Position"),
  237. 0,
  238. REG_DWORD,
  239. (LPBYTE)&lParam,
  240. sizeof(DWORD));
  241. RegCloseKey(hChildKey);
  242. }
  243. RegCloseKey(hKey);
  244. }
  245. break;
  246.         default:
  247.             if (!MyIsIMEMessage(message))
  248.                 return DefWindowProc(hWnd,message,wParam,lParam);
  249.             break;
  250.     }
  251. ReleaseDC(hWnd,hDC);
  252.     return 0;
  253. }
  254. void CreateStatusWindow( HWND hUIWnd, LPUIEXTRA lpUIExtra)
  255. {
  256.     if (!IsWindow(lpUIExtra->uiStatus.hWnd))
  257.     {
  258. RECT screenrc;
  259. HKEY hKey;
  260. DWORD dwPosition,dwData=sizeof(DWORD);
  261. BOOL fFlag=TRUE;
  262. lpUIExtra->uiStatus.sz.cx = BITMAPX * 6 ;
  263. lpUIExtra->uiStatus.sz.cy = BITMAPY ;
  264. if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE,
  265. _T("Software\freepy"),
  266. 0,
  267. KEY_READ,
  268. &hKey) == ERROR_SUCCESS ){
  269. if( RegQueryValueEx( hKey,
  270. _T("Position"),
  271. NULL,
  272. NULL,
  273. (LPBYTE)&dwPosition,
  274. &dwData) == ERROR_SUCCESS ){
  275. lpUIExtra->uiStatus.pt.x = (int)(short) LOWORD(dwPosition);
  276. lpUIExtra->uiStatus.pt.y = (int)(short) HIWORD(dwPosition);
  277. fFlag = FALSE;
  278. }
  279. RegCloseKey(hKey);
  280. }
  281. if(fFlag){
  282. SystemParametersInfo(SPI_GETWORKAREA,
  283. 0,
  284. &screenrc,
  285. 0);
  286. lpUIExtra->uiStatus.pt.x = screenrc.left + 10;
  287. lpUIExtra->uiStatus.pt.y = screenrc.bottom - lpUIExtra->uiStatus.sz.cy - 5;
  288. }
  289. lpUIExtra->uiStatus.hWnd = 
  290.                       CreateWindowEx( 0,
  291.                             STATUSCLASSNAME,NULL,
  292.                             WS_DISABLED | WS_POPUP,
  293.                             lpUIExtra->uiStatus.pt.x,
  294.                             lpUIExtra->uiStatus.pt.y,
  295. lpUIExtra->uiStatus.sz.cx,
  296. lpUIExtra->uiStatus.sz.cy,
  297.                             hUIWnd,NULL,hInst,NULL);
  298. SetWindowLong(lpUIExtra->uiStatus.hWnd,FIGWL_SVRWND,(DWORD)hUIWnd);
  299. }
  300. ShowWindow(lpUIExtra->uiStatus.hWnd,SW_SHOWNOACTIVATE);
  301.     return;
  302. }
  303. DWORD CheckButtonPos( HWND hStatusWnd, LPPOINT lppt)
  304. {
  305.     POINT pt;
  306.     RECT rc;
  307. DWORD dwButton = 0;
  308.     if (lppt)
  309.     {
  310.         pt = *lppt;
  311.         ScreenToClient(hStatusWnd,&pt);
  312.         GetClientRect(hStatusWnd,&rc);
  313.         if (!PtInRect(&rc,pt))
  314.             return 0;
  315. if(pt.x < BITMAPX) {
  316. dwButton |= BUTTONMENU;
  317. }
  318. else if (pt.x < BITMAPCHINESEDES) {
  319. dwButton |= BUTTONPY;
  320. }
  321. else if (pt.x < BITMAPFULLDES) {
  322. dwButton |= BUTTONCHINESE;
  323. }
  324. else if (pt.x < BITMAPPUNCTDES) {
  325. dwButton |= BUTTONFULL;
  326. }
  327. else if (pt.x < BITMAPPUNCTDES + BITMAPX) {
  328. dwButton |= BUTTONPUNCT;
  329. }
  330. }
  331.     return dwButton;
  332. }
  333. void PaintStatus( HWND hStatusWnd,HDC hDC,DWORD dwButton )
  334. {
  335.     HIMC hIMC;
  336.     LPINPUTCONTEXT lpIMC;
  337.     HDC hMemDC;
  338.     HBITMAP hBmpOld;
  339.     HWND hSvrWnd;
  340.     hSvrWnd = (HWND)GetWindowLong(hStatusWnd,FIGWL_SVRWND);
  341.     if (hIMC = (HIMC)GetWindowLong(hSvrWnd,IMMGWL_IMC))
  342.     {
  343.         lpIMC = ImmLockIMC(hIMC);
  344.         hMemDC = CreateCompatibleDC(hDC);
  345.         hBmpOld = SelectObject(hMemDC,hBmpStatus);
  346. if( (dwButton & BUTTONMENU) || !dwButton){
  347. if( dwButton & BUTTONPUSH)
  348. BitBlt(hDC,0,0,BITMAPX,BITMAPY,hMemDC,0,BITMAPY,SRCCOPY);
  349. else
  350. BitBlt(hDC,0,0,BITMAPX,BITMAPY,hMemDC,0,0,SRCCOPY);
  351. }
  352. if( (dwButton & BUTTONPY) || !dwButton){
  353. if( dwButton & BUTTONPUSH)
  354. BitBlt(hDC,BITMAPX,0,BITMAPX*2,BITMAPY,hMemDC,BITMAPX,BITMAPY,SRCCOPY);
  355. else
  356. BitBlt(hDC,BITMAPX,0,BITMAPX*2,BITMAPY,hMemDC,BITMAPX,0,SRCCOPY);
  357. }
  358. if( (dwButton & BUTTONCHINESE) || !dwButton){
  359. if(lpIMC->fOpen){
  360. if( dwButton & BUTTONPUSH)
  361. BitBlt(hDC,BITMAPCHINESEDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPCHINESESRC,BITMAPY,SRCCOPY);
  362. else
  363. BitBlt(hDC,BITMAPCHINESEDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPCHINESESRC,0,SRCCOPY);
  364. }
  365. else{
  366. if( dwButton & BUTTONPUSH)
  367. BitBlt(hDC,BITMAPCHINESEDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPCHINESESRC + BITMAPX,BITMAPY,SRCCOPY);
  368. else
  369. BitBlt(hDC,BITMAPCHINESEDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPCHINESESRC + BITMAPX,0,SRCCOPY);
  370. }
  371. }
  372. if( (dwButton & BUTTONFULL) || !dwButton){
  373. if(wConversionSet & CONVERSION_SET_FULLSHAPE) {
  374. if( dwButton & BUTTONPUSH)
  375. BitBlt(hDC,BITMAPFULLDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPFULLSRC,BITMAPY,SRCCOPY);
  376. else
  377. BitBlt(hDC,BITMAPFULLDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPFULLSRC,0,SRCCOPY);
  378. }
  379. else{
  380. if( dwButton & BUTTONPUSH)
  381. BitBlt(hDC,BITMAPFULLDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPFULLSRC + BITMAPX,BITMAPY,SRCCOPY);
  382. else
  383. BitBlt(hDC,BITMAPFULLDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPFULLSRC + BITMAPX,0,SRCCOPY);
  384. }
  385. }
  386. if( (dwButton & BUTTONPUNCT) || !dwButton){
  387. if(wConversionSet & CONVERSION_SET_PUNCT) {
  388. if( dwButton & BUTTONPUSH)
  389. BitBlt(hDC,BITMAPPUNCTDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPPUNCTSRC,BITMAPY,SRCCOPY);
  390. else
  391. BitBlt(hDC,BITMAPPUNCTDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPPUNCTSRC,0,SRCCOPY);
  392. }
  393. else{
  394. if( dwButton & BUTTONPUSH)
  395. BitBlt(hDC,BITMAPPUNCTDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPPUNCTSRC + BITMAPX,BITMAPY,SRCCOPY);
  396. else
  397. BitBlt(hDC,BITMAPPUNCTDES,0,BITMAPX,BITMAPY,hMemDC,BITMAPPUNCTSRC + BITMAPX,0,SRCCOPY);
  398. }
  399. }
  400. SelectObject(hMemDC,hBmpOld);
  401.         DeleteDC(hMemDC);
  402.         ImmUnlockIMC(hIMC);
  403.     }
  404. }
  405. void UpdateStatusWindow(LPUIEXTRA lpUIExtra)
  406. {
  407.     if (IsWindow(lpUIExtra->uiStatus.hWnd)) {
  408. InvalidateRect(lpUIExtra->uiStatus.hWnd,NULL,FALSE);
  409. }
  410. }
  411. BOOL WINAPI SetDialogProc(
  412. HWND hWnd ,
  413. UINT message ,
  414. WPARAM wParam ,
  415. LPARAM lParam )
  416. {
  417. switch(message) {
  418. case WM_INITDIALOG:
  419. CheckDlgButton(hWnd,IDC_CHECKSORT,
  420. (wConversionSet & CONVERSION_SET_SORT)? BST_CHECKED :BST_UNCHECKED );
  421. CheckDlgButton(hWnd,IDC_CHECKFOLLOW,
  422. (wConversionSet & CONVERSION_SET_FOLLOW)? BST_CHECKED :BST_UNCHECKED );
  423. CheckDlgButton(hWnd,IDC_CHECKGBK,
  424. (wConversionSet & CONVERSION_SET_GBK)? BST_CHECKED :BST_UNCHECKED );
  425. CheckDlgButton(hWnd,IDC_CHECKFUZZYC,
  426. (wConversionSet & CONVERSION_SET_FUZZYC)? BST_CHECKED :BST_UNCHECKED );
  427. CheckDlgButton(hWnd,IDC_CHECKFUZZYN,
  428. (wConversionSet & CONVERSION_SET_FUZZYN)? BST_CHECKED :BST_UNCHECKED );
  429. CheckDlgButton(hWnd,IDC_CHECKFUZZYH,
  430. (wConversionSet & CONVERSION_SET_FUZZYH)? BST_CHECKED :BST_UNCHECKED );
  431. CheckDlgButton(hWnd,IDC_CHECKFUZZYB,
  432. (wConversionSet & CONVERSION_SET_FUZZYB)? BST_CHECKED :BST_UNCHECKED );
  433. CheckDlgButton(hWnd,IDC_CHECKSHAPE,
  434. (wConversionSet & CONVERSION_SET_SHAPE)? BST_CHECKED :BST_UNCHECKED );
  435. break;
  436. case WM_COMMAND:
  437. switch(wParam) {
  438. case IDC_CHECKFUZZYC:
  439. break;
  440. case IDC_CHECKFUZZYN:
  441. break;
  442. case IDC_CHECKFUZZYH:
  443. break;
  444. case IDC_CHECKSORT:
  445. break;
  446. case IDOK:
  447. if(IsDlgButtonChecked(hWnd,IDC_CHECKSORT) == BST_CHECKED)
  448. wConversionSet |= CONVERSION_SET_SORT;
  449. else
  450. wConversionSet &= ~CONVERSION_SET_SORT;
  451. if(IsDlgButtonChecked(hWnd,IDC_CHECKFOLLOW) == BST_CHECKED)
  452. wConversionSet |= CONVERSION_SET_FOLLOW;
  453. else
  454. wConversionSet &= ~CONVERSION_SET_FOLLOW;
  455. if(IsDlgButtonChecked(hWnd,IDC_CHECKGBK) == BST_CHECKED)
  456. wConversionSet |= CONVERSION_SET_GBK;
  457. else
  458. wConversionSet &= ~CONVERSION_SET_GBK;
  459. if(IsDlgButtonChecked(hWnd,IDC_CHECKFUZZYC) == BST_CHECKED)
  460. wConversionSet |= CONVERSION_SET_FUZZYC;
  461. else
  462. wConversionSet &= ~CONVERSION_SET_FUZZYC;
  463. if(IsDlgButtonChecked(hWnd,IDC_CHECKFUZZYN) == BST_CHECKED)
  464. wConversionSet |= CONVERSION_SET_FUZZYN;
  465. else
  466. wConversionSet &= ~CONVERSION_SET_FUZZYN;
  467. if(IsDlgButtonChecked(hWnd,IDC_CHECKFUZZYH) == BST_CHECKED)
  468. wConversionSet |= CONVERSION_SET_FUZZYH;
  469. else
  470. wConversionSet &= ~CONVERSION_SET_FUZZYH;
  471. if(IsDlgButtonChecked(hWnd,IDC_CHECKFUZZYB) == BST_CHECKED)
  472. wConversionSet |= CONVERSION_SET_FUZZYB;
  473. else
  474. wConversionSet &= ~CONVERSION_SET_FUZZYB;
  475. if(IsDlgButtonChecked(hWnd,IDC_CHECKSHAPE) == BST_CHECKED)
  476. wConversionSet |= CONVERSION_SET_SHAPE;
  477. else
  478. wConversionSet &= ~CONVERSION_SET_SHAPE;
  479. EndDialog(hWnd,TRUE);
  480. break;
  481. case IDCANCEL:
  482. EndDialog(hWnd,TRUE);
  483. break;
  484. default:
  485. return FALSE;
  486. break;
  487. }
  488. break;
  489. default:
  490. return FALSE;
  491. break;
  492. }
  493. return TRUE;
  494. }
  495. BOOL WINAPI AboutDialogProc(
  496. HWND hWnd ,
  497. UINT message ,
  498. WPARAM wParam ,
  499. LPARAM lParam )
  500. {
  501. switch(message) {
  502. case WM_INITDIALOG:
  503. break;
  504. case WM_COMMAND:
  505. switch(wParam) {
  506. case IDOK:
  507. case IDCANCEL:
  508. EndDialog(hWnd,TRUE);
  509. break;
  510. default:
  511. return FALSE;
  512. break;
  513. }
  514. break;
  515. default:
  516. return FALSE;
  517. break;
  518. }
  519. return TRUE;
  520. }