Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

659 lines
16 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2 Sample Code
  4. **
  5. ** dialogs.c
  6. **
  7. ** This file contains dialog functions and support function
  8. **
  9. ** (c) Copyright Microsoft Corp. 1992 - 1993 All Rights Reserved
  10. **
  11. *************************************************************************/
  12. #include "outline.h"
  13. OLEDBGDATA
  14. extern LPOUTLINEAPP g_lpApp;
  15. static char g_szBuf[MAXSTRLEN+1];
  16. static LPSTR g_lpszDlgTitle;
  17. // REVIEW: should use string resource for messages
  18. static char ErrMsgInvalidRange[] = "Invalid Range entered!";
  19. static char ErrMsgInvalidValue[] = "Invalid Value entered!";
  20. static char ErrMsgInvalidName[] = "Invalid Name entered!";
  21. static char ErrMsgNullName[] = "NULL string disallowed!";
  22. static char ErrMsgNameNotFound[] = "Name doesn't exist!";
  23. /* InputTextDlg
  24. * ------------
  25. *
  26. * Put up a dialog box to allow the user to edit text
  27. */
  28. BOOL InputTextDlg(HWND hWnd, LPSTR lpszText, LPSTR lpszDlgTitle)
  29. {
  30. int nResult;
  31. g_lpszDlgTitle = lpszDlgTitle;
  32. lstrcpy((LPSTR)g_szBuf, lpszText); // preload dialog with input text
  33. nResult = DialogBox(g_lpApp->m_hInst, (LPSTR)"AddEditLine", hWnd,
  34. (DLGPROC)AddEditDlgProc);
  35. if (nResult) {
  36. lstrcpy(lpszText, (LPSTR)g_szBuf);
  37. return TRUE;
  38. } else {
  39. return FALSE;
  40. }
  41. }
  42. /* AddEditDlgProc
  43. * --------------
  44. *
  45. * This procedure is associated with the dialog box that is included in
  46. * the function name of the procedure. It provides the service routines
  47. * for the events (messages) that occur because the end user operates
  48. * one of the dialog box's buttons, entry fields, or controls.
  49. */
  50. BOOL CALLBACK EXPORT AddEditDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
  51. {
  52. HWND hEdit;
  53. switch(Message) {
  54. case WM_INITDIALOG:
  55. /* initialize working variables */
  56. hEdit=GetDlgItem(hDlg,IDD_EDIT);
  57. SendMessage(hEdit,EM_LIMITTEXT,(WPARAM)MAXSTRLEN,0L);
  58. SetWindowText(hDlg, g_lpszDlgTitle);
  59. SetDlgItemText(hDlg,IDD_EDIT, g_szBuf);
  60. break; /* End of WM_INITDIALOG */
  61. case WM_CLOSE:
  62. /* Closing the Dialog behaves the same as Cancel */
  63. PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0L);
  64. break; /* End of WM_CLOSE */
  65. case WM_COMMAND:
  66. switch (wParam) {
  67. case IDOK:
  68. /* save data values entered into the controls
  69. ** and dismiss the dialog box returning TRUE
  70. */
  71. GetDlgItemText(hDlg,IDD_EDIT,(LPSTR)g_szBuf,MAXSTRLEN+1);
  72. EndDialog(hDlg, TRUE);
  73. break;
  74. case IDCANCEL:
  75. /* ignore data values entered into the controls
  76. ** and dismiss the dialog box returning FALSE
  77. */
  78. EndDialog(hDlg, FALSE);
  79. break;
  80. }
  81. break; /* End of WM_COMMAND */
  82. default:
  83. return FALSE;
  84. }
  85. return TRUE;
  86. } /* End of AddEditDlgProc */
  87. /* SetLineHeightDlgProc
  88. * --------------------
  89. *
  90. * Dialog procedure for set line height
  91. */
  92. BOOL CALLBACK EXPORT SetLineHeightDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
  93. {
  94. BOOL fTranslated;
  95. BOOL fEnable;
  96. static LPINT lpint;
  97. int nHeight;
  98. static int nMaxHeight;
  99. switch (Message) {
  100. case WM_INITDIALOG:
  101. {
  102. char cBuf[80];
  103. nMaxHeight = XformHeightInPixelsToHimetric(NULL,
  104. LISTBOX_HEIGHT_LIMIT);
  105. lpint = (LPINT)lParam;
  106. SetDlgItemInt(hDlg, IDD_EDIT, *lpint, FALSE);
  107. wsprintf(cBuf, "Maximum value is %d units", nMaxHeight);
  108. SetDlgItemText(hDlg, IDD_LIMIT, (LPSTR)cBuf);
  109. break;
  110. }
  111. case WM_COMMAND:
  112. switch (wParam) {
  113. case IDOK:
  114. if (IsDlgButtonChecked(hDlg, IDD_CHECK)) {
  115. *lpint = -1;
  116. }
  117. else {
  118. /* save the value in the edit control */
  119. nHeight = GetDlgItemInt(hDlg, IDD_EDIT,
  120. (BOOL FAR*)&fTranslated, FALSE);
  121. if (!fTranslated || !nHeight || (nHeight>nMaxHeight)){
  122. OutlineApp_ErrorMessage(g_lpApp,
  123. ErrMsgInvalidValue);
  124. break;
  125. }
  126. *lpint = nHeight;
  127. }
  128. EndDialog(hDlg, TRUE);
  129. break;
  130. case IDCANCEL:
  131. *lpint = 0;
  132. EndDialog(hDlg, FALSE);
  133. break;
  134. case IDD_CHECK:
  135. fEnable = !IsDlgButtonChecked(hDlg, IDD_CHECK);
  136. EnableWindow(GetDlgItem(hDlg, IDD_EDIT), fEnable);
  137. EnableWindow(GetDlgItem(hDlg, IDD_TEXT), fEnable);
  138. break;
  139. }
  140. break; /* WM_COMMAND */
  141. case WM_CLOSE: /* Closing the Dialog behaves the same as Cancel */
  142. PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0L);
  143. break; /* End of WM_CLOSE */
  144. default:
  145. return FALSE;
  146. }
  147. return TRUE;
  148. } /* end of SetLineHeightProc */
  149. /* DefineNameDlgProc
  150. * -----------------
  151. *
  152. * Dialog procedure for define name
  153. */
  154. BOOL CALLBACK EXPORT DefineNameDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
  155. {
  156. static HWND hCombo;
  157. static LPOUTLINEDOC lpOutlineDoc = NULL;
  158. static LPOUTLINENAMETABLE lpOutlineNameTable = NULL;
  159. LPOUTLINENAME lpOutlineName = NULL;
  160. UINT nIndex;
  161. LINERANGE lrSel;
  162. BOOL fTranslated;
  163. switch(Message) {
  164. case WM_INITDIALOG:
  165. /* initialize working variables */
  166. hCombo=GetDlgItem(hDlg,IDD_COMBO);
  167. lpOutlineDoc = (LPOUTLINEDOC) lParam;
  168. lpOutlineNameTable = OutlineDoc_GetNameTable(lpOutlineDoc);
  169. SendMessage(hCombo,CB_LIMITTEXT,(WPARAM)MAXNAMESIZE,0L);
  170. NameDlg_LoadComboBox(lpOutlineNameTable, hCombo);
  171. OutlineDoc_GetSel(lpOutlineDoc, (LPLINERANGE)&lrSel);
  172. lpOutlineName = OutlineNameTable_FindNamedRange(
  173. lpOutlineNameTable,
  174. &lrSel
  175. );
  176. /* if current selection already has a name, hilight it */
  177. if (lpOutlineName) {
  178. nIndex = (int) SendMessage(
  179. hCombo,
  180. CB_FINDSTRINGEXACT,
  181. (WPARAM)0xffff,
  182. (LPARAM)(LPCSTR)lpOutlineName->m_szName
  183. );
  184. if (nIndex != CB_ERR) {
  185. SendMessage(hCombo, CB_SETCURSEL, (WPARAM)nIndex, 0L);
  186. }
  187. }
  188. SetDlgItemInt(hDlg, IDD_FROM, (UINT)lrSel.m_nStartLine+1,FALSE);
  189. SetDlgItemInt(hDlg, IDD_TO, (UINT)lrSel.m_nEndLine+1, FALSE);
  190. break; /* End of WM_INITDIALOG */
  191. case WM_CLOSE:
  192. /* Closing the Dialog behaves the same as Cancel */
  193. PostMessage(hDlg, WM_COMMAND, IDD_CLOSE, 0L);
  194. break; /* End of WM_CLOSE */
  195. case WM_COMMAND:
  196. switch(wParam) {
  197. case IDOK:
  198. GetDlgItemText(hDlg,IDD_COMBO,(LPSTR)g_szBuf,MAXNAMESIZE);
  199. if(! SendMessage(hCombo,WM_GETTEXTLENGTH,0,0L)) {
  200. MessageBox(
  201. hDlg,
  202. ErrMsgNullName,
  203. NULL,
  204. MB_ICONEXCLAMATION
  205. );
  206. break;
  207. } else if(SendMessage(hCombo,CB_GETCURSEL,0,0L)==CB_ERR &&
  208. _fstrchr(g_szBuf, ' ')) {
  209. MessageBox(
  210. hDlg,
  211. ErrMsgInvalidName,
  212. NULL,
  213. MB_ICONEXCLAMATION
  214. );
  215. break;
  216. } else {
  217. nIndex = (int) SendMessage(hCombo,CB_FINDSTRINGEXACT,
  218. (WPARAM)0xffff,(LPARAM)(LPCSTR)g_szBuf);
  219. /* Line indices are 1 less than the number in
  220. ** the row heading
  221. */
  222. lrSel.m_nStartLine = GetDlgItemInt(hDlg, IDD_FROM,
  223. (BOOL FAR*)&fTranslated, FALSE) - 1;
  224. if(! fTranslated) {
  225. OutlineApp_ErrorMessage(g_lpApp,
  226. ErrMsgInvalidRange);
  227. break;
  228. }
  229. lrSel.m_nEndLine = GetDlgItemInt(hDlg, IDD_TO,
  230. (BOOL FAR*)&fTranslated, FALSE) - 1;
  231. if (!fTranslated ||
  232. (lrSel.m_nStartLine < 0) ||
  233. (lrSel.m_nEndLine < lrSel.m_nStartLine) ||
  234. (lrSel.m_nEndLine >= OutlineDoc_GetLineCount(
  235. lpOutlineDoc))) {
  236. OutlineApp_ErrorMessage(g_lpApp,
  237. ErrMsgInvalidRange);
  238. break;
  239. }
  240. if(nIndex != CB_ERR) {
  241. NameDlg_UpdateName(
  242. hCombo,
  243. lpOutlineDoc,
  244. nIndex,
  245. g_szBuf,
  246. &lrSel
  247. );
  248. } else {
  249. NameDlg_AddName(
  250. hCombo,
  251. lpOutlineDoc,
  252. g_szBuf,
  253. &lrSel
  254. );
  255. }
  256. }
  257. // fall through
  258. case IDD_CLOSE:
  259. /* Ignore data values entered into the controls */
  260. /* and dismiss the dialog window returning FALSE */
  261. EndDialog(hDlg,0);
  262. break;
  263. case IDD_DELETE:
  264. GetDlgItemText(hDlg,IDD_COMBO,(LPSTR)g_szBuf,MAXNAMESIZE);
  265. if((nIndex=(int)SendMessage(hCombo,CB_FINDSTRINGEXACT,
  266. (WPARAM)0xffff,(LPARAM)(LPCSTR)g_szBuf))==CB_ERR)
  267. MessageBox(hDlg, ErrMsgNameNotFound, NULL, MB_ICONEXCLAMATION);
  268. else {
  269. NameDlg_DeleteName(hCombo, lpOutlineDoc, nIndex);
  270. }
  271. break;
  272. case IDD_COMBO:
  273. if(HIWORD(lParam) == CBN_SELCHANGE) {
  274. nIndex=(int)SendMessage(hCombo, CB_GETCURSEL, 0, 0L);
  275. lpOutlineName = (LPOUTLINENAME)SendMessage(
  276. hCombo,
  277. CB_GETITEMDATA,
  278. (WPARAM)nIndex,
  279. 0L
  280. );
  281. SetDlgItemInt(
  282. hDlg,
  283. IDD_FROM,
  284. (UINT) lpOutlineName->m_nStartLine + 1,
  285. FALSE
  286. );
  287. SetDlgItemInt(
  288. hDlg,
  289. IDD_TO,
  290. (UINT) lpOutlineName->m_nEndLine + 1,
  291. FALSE
  292. );
  293. }
  294. }
  295. break; /* End of WM_COMMAND */
  296. default:
  297. return FALSE;
  298. }
  299. return TRUE;
  300. } /* End of DefineNameDlgProc */
  301. /* GotoNameDlgProc
  302. * ---------------
  303. *
  304. * Dialog procedure for goto name
  305. */
  306. BOOL CALLBACK EXPORT GotoNameDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
  307. {
  308. static HWND hLBName;
  309. static LPOUTLINEDOC lpOutlineDoc = NULL;
  310. static LPOUTLINENAMETABLE lpOutlineNameTable = NULL;
  311. UINT nIndex;
  312. LINERANGE lrLineRange;
  313. LPOUTLINENAME lpOutlineName;
  314. switch(Message) {
  315. case WM_INITDIALOG:
  316. /* initialize working variables */
  317. lpOutlineDoc = (LPOUTLINEDOC) lParam;
  318. lpOutlineNameTable = OutlineDoc_GetNameTable(lpOutlineDoc);
  319. hLBName=GetDlgItem(hDlg,IDD_LINELISTBOX);
  320. NameDlg_LoadListBox(lpOutlineNameTable, hLBName);
  321. // highlight 1st item
  322. SendMessage(hLBName, LB_SETCURSEL, 0, 0L);
  323. // trigger to initialize edit control
  324. SendMessage(hDlg, WM_COMMAND, (WPARAM)IDD_LINELISTBOX,
  325. MAKELONG(hLBName, LBN_SELCHANGE));
  326. break; /* End of WM_INITDIALOG */
  327. case WM_CLOSE:
  328. /* Closing the Dialog behaves the same as Cancel */
  329. PostMessage(hDlg, WM_COMMAND, IDCANCEL, 0L);
  330. break; /* End of WM_CLOSE */
  331. case WM_COMMAND:
  332. switch(wParam) {
  333. case IDD_LINELISTBOX:
  334. if(HIWORD(lParam) == LBN_SELCHANGE) {
  335. // update the line range display
  336. nIndex=(int)SendMessage(hLBName, LB_GETCURSEL, 0, 0L);
  337. lpOutlineName = (LPOUTLINENAME)SendMessage(hLBName, LB_GETITEMDATA,
  338. (WPARAM)nIndex,0L);
  339. if (lpOutlineName) {
  340. SetDlgItemInt(
  341. hDlg,
  342. IDD_FROM,
  343. (UINT) lpOutlineName->m_nStartLine + 1,
  344. FALSE
  345. );
  346. SetDlgItemInt(
  347. hDlg,
  348. IDD_TO,
  349. (UINT) lpOutlineName->m_nEndLine + 1,
  350. FALSE
  351. );
  352. }
  353. break;
  354. }
  355. // double click will fall through
  356. else if(HIWORD(lParam) != LBN_DBLCLK)
  357. break;
  358. case IDOK:
  359. nIndex=(int)SendMessage(hLBName,LB_GETCURSEL,0,0L);
  360. if(nIndex!=LB_ERR) {
  361. lpOutlineName = (LPOUTLINENAME)SendMessage(hLBName,
  362. LB_GETITEMDATA, (WPARAM)nIndex, 0L);
  363. lrLineRange.m_nStartLine=lpOutlineName->m_nStartLine;
  364. lrLineRange.m_nEndLine = lpOutlineName->m_nEndLine;
  365. OutlineDoc_SetSel(lpOutlineDoc, &lrLineRange);
  366. } // fall through
  367. case IDCANCEL:
  368. /* Ignore data values entered into the controls */
  369. /* and dismiss the dialog window returning FALSE */
  370. EndDialog(hDlg,0);
  371. break;
  372. }
  373. break; /* End of WM_COMMAND */
  374. default:
  375. return FALSE;
  376. }
  377. return TRUE;
  378. } /* End of GotoNameDlgProc */
  379. /* NameDlg_LoadComboBox
  380. * --------------------
  381. *
  382. * Load defined names into combo box
  383. */
  384. void NameDlg_LoadComboBox(LPOUTLINENAMETABLE lpOutlineNameTable,HWND hCombo)
  385. {
  386. LPOUTLINENAME lpOutlineName;
  387. int i, nIndex;
  388. int nCount;
  389. nCount=OutlineNameTable_GetCount((LPOUTLINENAMETABLE)lpOutlineNameTable);
  390. if(!nCount) return;
  391. SendMessage(hCombo,WM_SETREDRAW,(WPARAM)FALSE,0L);
  392. for(i=0; i<nCount; i++) {
  393. lpOutlineName=OutlineNameTable_GetName((LPOUTLINENAMETABLE)lpOutlineNameTable,i);
  394. nIndex = (int)SendMessage(
  395. hCombo,
  396. CB_ADDSTRING,
  397. 0,
  398. (LPARAM)(LPCSTR)lpOutlineName->m_szName
  399. );
  400. SendMessage(hCombo,CB_SETITEMDATA,(WPARAM)nIndex,(LPARAM)lpOutlineName);
  401. }
  402. SendMessage(hCombo,WM_SETREDRAW,(WPARAM)TRUE,0L);
  403. }
  404. /* NameDlg_LoadListBox
  405. * -------------------
  406. *
  407. * Load defined names into list box
  408. */
  409. void NameDlg_LoadListBox(LPOUTLINENAMETABLE lpOutlineNameTable,HWND hListBox)
  410. {
  411. int i;
  412. int nCount;
  413. int nIndex;
  414. LPOUTLINENAME lpOutlineName;
  415. nCount=OutlineNameTable_GetCount((LPOUTLINENAMETABLE)lpOutlineNameTable);
  416. SendMessage(hListBox,WM_SETREDRAW,(WPARAM)FALSE,0L);
  417. for(i=0; i<nCount; i++) {
  418. lpOutlineName=OutlineNameTable_GetName((LPOUTLINENAMETABLE)lpOutlineNameTable,i);
  419. nIndex = (int)SendMessage(
  420. hListBox,
  421. LB_ADDSTRING,
  422. 0,
  423. (LPARAM)(LPCSTR)lpOutlineName->m_szName
  424. );
  425. SendMessage(hListBox,LB_SETITEMDATA,(WPARAM)nIndex,(LPARAM)lpOutlineName);
  426. }
  427. SendMessage(hListBox,WM_SETREDRAW,(WPARAM)TRUE,0L);
  428. }
  429. /* NameDlg_AddName
  430. * ---------------
  431. *
  432. * Add a name to the name table corresponding to the name dialog
  433. * combo box.
  434. */
  435. void NameDlg_AddName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, LPSTR lpszName, LPLINERANGE lplrSel)
  436. {
  437. LPOUTLINEAPP lpOutlineApp = (LPOUTLINEAPP)g_lpApp;
  438. LPOUTLINENAME lpOutlineName;
  439. lpOutlineName = OutlineApp_CreateName(lpOutlineApp);
  440. if (lpOutlineName) {
  441. lstrcpy(lpOutlineName->m_szName, lpszName);
  442. lpOutlineName->m_nStartLine = lplrSel->m_nStartLine;
  443. lpOutlineName->m_nEndLine = lplrSel->m_nEndLine;
  444. OutlineDoc_AddName(lpOutlineDoc, lpOutlineName);
  445. } else {
  446. // REVIEW: do we need error message here?
  447. }
  448. }
  449. /* NameDlg_UpdateName
  450. * ------------------
  451. *
  452. * Update a name in the name table corresponding to a name in
  453. * the name dialog combo box.
  454. */
  455. void NameDlg_UpdateName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, int nIndex, LPSTR lpszName, LPLINERANGE lplrSel)
  456. {
  457. LPOUTLINENAME lpOutlineName;
  458. lpOutlineName = (LPOUTLINENAME)SendMessage(
  459. hCombo,
  460. CB_GETITEMDATA,
  461. (WPARAM)nIndex,
  462. 0L
  463. );
  464. OutlineName_SetName(lpOutlineName, lpszName);
  465. OutlineName_SetSel(lpOutlineName, lplrSel, TRUE /* name modified */);
  466. OutlineDoc_SetModified(lpOutlineDoc, TRUE, FALSE, FALSE);
  467. }
  468. /* NameDlg_DeleteName
  469. * ------------------
  470. *
  471. * Delete a name from the name dialog combo box and corresponding
  472. * name table.
  473. */
  474. void NameDlg_DeleteName(HWND hCombo, LPOUTLINEDOC lpOutlineDoc, UINT nIndex)
  475. {
  476. SendMessage(hCombo,CB_DELETESTRING,(WPARAM)nIndex,0L);
  477. OutlineDoc_DeleteName(lpOutlineDoc, nIndex);
  478. }
  479. /* PlaceBitmap
  480. * -----------
  481. *
  482. * Places a bitmap centered in the specified control in the dialog on the
  483. * specified DC.
  484. *
  485. */
  486. PlaceBitmap(HWND hDlg, int control, HDC hDC, HBITMAP hBitmap)
  487. {
  488. BITMAP bm;
  489. HDC hdcmem;
  490. HBITMAP hbmOld;
  491. RECT rcControl; // Rect of dialog control
  492. int width, height;
  493. GetObject(hBitmap, sizeof(BITMAP), &bm);
  494. hdcmem= CreateCompatibleDC(hDC);
  495. hbmOld = SelectObject(hdcmem, hBitmap);
  496. // Get rect of control in screen coords, and translate to our dialog
  497. // box's coordinates
  498. GetWindowRect(GetDlgItem(hDlg, control), &rcControl);
  499. MapWindowPoints(NULL, hDlg, (LPPOINT)&rcControl, 2);
  500. width = rcControl.right - rcControl.left;
  501. height = rcControl.bottom - rcControl.top;
  502. BitBlt(hDC, rcControl.left + (width - bm.bmWidth) / 2,
  503. rcControl.top + (height - bm.bmHeight) /2,
  504. bm.bmWidth, bm.bmHeight,
  505. hdcmem, 0, 0, SRCCOPY);
  506. SelectObject(hdcmem, hbmOld);
  507. DeleteDC(hdcmem);
  508. return 1;
  509. }
  510. /* AboutDlgProc
  511. * ------------
  512. *
  513. * Dialog procedure for the About function
  514. */
  515. BOOL CALLBACK EXPORT AboutDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam)
  516. {
  517. int narrVersion[2];
  518. static HBITMAP hbmLogo;
  519. switch(Message) {
  520. case WM_INITDIALOG:
  521. // get version number of app
  522. wsprintf(g_szBuf, "About %s", (LPCSTR)APPNAME);
  523. SetWindowText(hDlg, (LPCSTR)g_szBuf);
  524. OutlineApp_GetAppVersionNo(g_lpApp, narrVersion);
  525. wsprintf(g_szBuf, "%s version %d.%d", (LPSTR) APPDESC,
  526. narrVersion[0], narrVersion[1]);
  527. SetDlgItemText(hDlg, IDD_APPTEXT, (LPCSTR)g_szBuf);
  528. // Load bitmap for displaying later
  529. hbmLogo = LoadBitmap(g_lpApp->m_hInst, "LogoBitmap");
  530. TraceDebug(hDlg, IDD_BITMAPLOCATION);
  531. ShowWindow(GetDlgItem(hDlg, IDD_BITMAPLOCATION), SW_HIDE);
  532. break;
  533. case WM_PAINT:
  534. {
  535. PAINTSTRUCT ps;
  536. BeginPaint(hDlg, &ps);
  537. // Display bitmap in IDD_BITMAPLOCATION control area
  538. PlaceBitmap(hDlg, IDD_BITMAPLOCATION, ps.hdc, hbmLogo);
  539. EndPaint(hDlg, &ps);
  540. }
  541. break;
  542. case WM_CLOSE :
  543. PostMessage(hDlg, WM_COMMAND, IDOK, 0L);
  544. break;
  545. case WM_COMMAND :
  546. switch(wParam) {
  547. case IDOK:
  548. case IDCANCEL:
  549. if (hbmLogo) DeleteObject(hbmLogo);
  550. EndDialog(hDlg,0);
  551. break;
  552. }
  553. break;
  554. default :
  555. return FALSE;
  556. }
  557. return TRUE;
  558. }