Leaked source code of windows server 2003
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.

529 lines
20 KiB

  1. #include "precomp.h"
  2. #include "rsop.h"
  3. #include <comdef.h>
  4. #include <tchar.h>
  5. #include "btoolbar.h"
  6. static INT_PTR CALLBACK editBToolbarRSoPProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
  7. ///////////////////////////////////////////////////////////
  8. DWORD InitToolbarDlgInRSoPMode(HWND hDlg, CDlgRSoPData *pDRD)
  9. {
  10. DWORD dwRet = 0;
  11. BOOL bDelete = false,
  12. bBkgnd = false;
  13. __try
  14. {
  15. // First go through all PS objects and look for deleteExistingToolbarButtons
  16. _bstr_t bstrClass = L"RSOP_IEAKPolicySetting";
  17. HRESULT hr = pDRD->GetArrayOfPSObjects(bstrClass);
  18. if (SUCCEEDED(hr))
  19. {
  20. CPSObjData **paPSObj = pDRD->GetPSObjArray();
  21. long nPSObjects = pDRD->GetPSObjCount();
  22. for (long nObj = 0; nObj < nPSObjects; nObj++)
  23. {
  24. // deleteExistingToolbarButtons field
  25. _variant_t vtValue;
  26. if (!bDelete)
  27. {
  28. hr = paPSObj[nObj]->pObj->Get(L"deleteExistingToolbarButtons", 0, &vtValue, NULL, NULL);
  29. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  30. {
  31. if ((bool)vtValue)
  32. CheckDlgButton(hDlg, IDC_DELETEBTOOLBARS, BST_CHECKED);
  33. bDelete = true;
  34. }
  35. }
  36. // toolbarBackgroundBitmap field
  37. _bstr_t bstrValue;
  38. if (!bBkgnd)
  39. {
  40. hr = paPSObj[nObj]->pObj->Get(L"toolbarBackgroundBitmapPath", 0, &vtValue, NULL, NULL);
  41. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  42. {
  43. bstrValue = vtValue;
  44. BOOL bChecked = (bstrValue.length() > 0);
  45. SetDlgItemTextTriState(hDlg, IDE_TOOLBARBMP, IDC_BG_CUSTOM, (LPTSTR)bstrValue, bChecked);
  46. bBkgnd = true;
  47. }
  48. }
  49. // no need to process other GPOs since enabled properties have been found
  50. if (bBkgnd && bDelete)
  51. break;
  52. }
  53. }
  54. EnableDlgItem2(hDlg, IDC_DELETEBTOOLBARS, FALSE);
  55. // Now go through all Toolbar objects and populate the list box
  56. bstrClass = L"RSOP_IEToolbarButton";
  57. CPSObjData **paTBObj = NULL;
  58. long nTBObjects = 0;
  59. hr = pDRD->GetArrayOfPSObjects(bstrClass, L"rsopPrecedence",
  60. &paTBObj, &nTBObjects);
  61. if (SUCCEEDED(hr))
  62. {
  63. HWND hwndList = GetDlgItem(hDlg, IDC_BTOOLBARLIST);
  64. ListBox_ResetContent(hwndList);
  65. PBTOOLBAR paBToolbar = (PBTOOLBAR)CoTaskMemAlloc(sizeof(BTOOLBAR) * MAX_BTOOLBARS);
  66. if (paBToolbar != NULL)
  67. {
  68. ZeroMemory(paBToolbar, sizeof(BTOOLBAR) * MAX_BTOOLBARS);
  69. // For each button returned from any GPO
  70. long nObj;
  71. PBTOOLBAR pBToolbar;
  72. for (nObj = 0, pBToolbar = paBToolbar; nObj < nTBObjects;
  73. nObj++, pBToolbar++)
  74. {
  75. _bstr_t bstrGPOName = L" (";
  76. bstrGPOName += pDRD->GetGPONameFromPSAssociation(paTBObj[nObj]->pObj,L"rsopPrecedence") + L")";
  77. // caption field
  78. _variant_t vtValue;
  79. hr = paTBObj[nObj]->pObj->Get(L"caption", 0, &vtValue, NULL, NULL);
  80. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  81. {
  82. _bstr_t bstrValue = vtValue;
  83. _bstr_t bstrEntry = bstrValue + bstrGPOName;
  84. StrCpy(pBToolbar->szCaption, (LPCTSTR)bstrValue);
  85. // iconPath field
  86. hr = paTBObj[nObj]->pObj->Get(L"iconPath", 0, &vtValue, NULL, NULL);
  87. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  88. {
  89. bstrValue = vtValue;
  90. StrCpy(pBToolbar->szIcon, (LPCTSTR)bstrValue);
  91. }
  92. // actionPath field
  93. hr = paTBObj[nObj]->pObj->Get(L"actionPath", 0, &vtValue, NULL, NULL);
  94. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  95. {
  96. bstrValue = vtValue;
  97. StrCpy(pBToolbar->szAction, (LPCTSTR)bstrValue);
  98. }
  99. // hotIconPath field
  100. hr = paTBObj[nObj]->pObj->Get(L"hotIconPath", 0, &vtValue, NULL, NULL);
  101. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  102. {
  103. bstrValue = vtValue;
  104. StrCpy(pBToolbar->szHotIcon, (LPCTSTR)bstrValue);
  105. }
  106. // showOnToolbarByDefault field
  107. hr = paTBObj[nObj]->pObj->Get(L"showOnToolbarByDefault", 0, &vtValue, NULL, NULL);
  108. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  109. pBToolbar->fShow = (bool)vtValue ? TRUE : FALSE;
  110. int nItem = ListBox_AddString(hwndList, (LPCTSTR)bstrEntry);
  111. ListBox_SetItemData(hwndList, (WPARAM)nItem, (LPARAM)pBToolbar);
  112. }
  113. }
  114. dwRet = nObj;
  115. PBTOOLBAR paOldBToolbar = (PBTOOLBAR)SetWindowLongPtr(hwndList, GWLP_USERDATA, (LONG_PTR)paBToolbar);
  116. // delete previous allocation(mainly for profile manager)
  117. if (paOldBToolbar != NULL)
  118. CoTaskMemFree(paOldBToolbar);
  119. }
  120. CoTaskMemFree(paTBObj);
  121. }
  122. }
  123. __except(TRUE)
  124. {
  125. }
  126. return dwRet;
  127. }
  128. /////////////////////////////////////////////////////////////////////
  129. HRESULT InitBToolbarPrecPage(CDlgRSoPData *pDRD, HWND hwndList)
  130. {
  131. HRESULT hr = NOERROR;
  132. __try
  133. {
  134. _bstr_t bstrClass = L"RSOP_IEAKPolicySetting";
  135. hr = pDRD->GetArrayOfPSObjects(bstrClass);
  136. if (SUCCEEDED(hr))
  137. {
  138. CPSObjData **paPSObj = pDRD->GetPSObjArray();
  139. long nPSObjects = pDRD->GetPSObjCount();
  140. for (long nObj = 0; nObj < nPSObjects; nObj++)
  141. {
  142. _bstr_t bstrGPOName = pDRD->GetGPONameFromPS(paPSObj[nObj]->pObj);
  143. // deleteExistingToolbarButtons field
  144. BOOL bDeleteExisting = FALSE;
  145. _variant_t vtValue;
  146. hr = paPSObj[nObj]->pObj->Get(L"deleteExistingToolbarButtons", 0, &vtValue, NULL, NULL);
  147. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  148. bDeleteExisting = (bool)vtValue ? TRUE : FALSE;
  149. // toolbarButtons field
  150. long nTBCount = 0;
  151. hr = paPSObj[nObj]->pObj->Get(L"toolbarButtons", 0, &vtValue, NULL, NULL);
  152. if (SUCCEEDED(hr) && !IsVariantNull(vtValue))
  153. nTBCount = vtValue;
  154. _bstr_t bstrSetting;
  155. if (bDeleteExisting || nTBCount > 0)
  156. {
  157. TCHAR szTemp[MAX_PATH];
  158. if (bDeleteExisting)
  159. LoadString(g_hInstance, IDS_BTOOLBAR_DEL_SETTING, szTemp, countof(szTemp));
  160. else
  161. LoadString(g_hInstance, IDS_BTOOLBAR_SETTING, szTemp, countof(szTemp));
  162. TCHAR szSetting[MAX_PATH];
  163. wnsprintf(szSetting, countof(szSetting), szTemp, nTBCount);
  164. bstrSetting = szSetting;
  165. }
  166. else
  167. bstrSetting = GetDisabledString();
  168. InsertPrecedenceListItem(hwndList, nObj, bstrGPOName, bstrSetting);
  169. }
  170. }
  171. }
  172. __except(TRUE)
  173. {
  174. }
  175. return hr;
  176. }
  177. ///////////////////////////////////////////////////////////
  178. INT_PTR CALLBACK BToolbarsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
  179. {
  180. // Retrieve Property Sheet Page info for each call into dlg proc.
  181. LPPROPSHEETCOOKIE psCookie = (LPPROPSHEETCOOKIE)GetWindowLongPtr(hDlg, DWLP_USER);
  182. TCHAR szToolbarBmp[MAX_PATH];
  183. TCHAR szWorkDir[MAX_PATH];
  184. TCHAR szTemp[MAX_PATH];
  185. BOOL fToolbarBmp;
  186. LPVOID lpVoid;
  187. INT iBackground;
  188. switch( msg )
  189. {
  190. case WM_SETFONT:
  191. //a change to mmc requires us to do this logic for all our property pages that use common controls
  192. INITCOMMONCONTROLSEX iccx;
  193. iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
  194. iccx.dwICC = ICC_ANIMATE_CLASS | ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES |ICC_TREEVIEW_CLASSES;
  195. InitCommonControlsEx(&iccx);
  196. break;
  197. case WM_INITDIALOG:
  198. SetPropSheetCookie(hDlg, lParam);
  199. // ---- Toolbar background
  200. EnableDBCSChars(hDlg, IDE_TOOLBARBMP);
  201. Edit_LimitText(GetDlgItem(hDlg, IDE_TOOLBARBMP), countof(szToolbarBmp) - 1);
  202. // ---- Toolbar bitmaps
  203. // ---- Toolbar buttons
  204. EnableDBCSChars(hDlg, IDC_BTOOLBARLIST);
  205. // find out if this dlg is in RSoP mode
  206. psCookie = (LPPROPSHEETCOOKIE)GetWindowLongPtr(hDlg, DWLP_USER);
  207. if (psCookie->pCS->IsRSoP())
  208. {
  209. TCHAR szView[64];
  210. LoadString(g_hInstance, IDS_VIEW, szView, countof(szView));
  211. SetDlgItemText(hDlg, IDC_EDITBTOOLBAR, szView);
  212. EnableDlgItem2(hDlg, IDC_ADDBTOOLBAR, FALSE);
  213. EnableDlgItem2(hDlg, IDC_REMOVEBTOOLBAR, FALSE);
  214. EnableDlgItem2(hDlg, IDC_BGIE6, FALSE);
  215. EnableDlgItem2(hDlg, IDC_BG_CUSTOM, FALSE);
  216. EnableDlgItem2(hDlg, IDC_BROWSETBB, FALSE);
  217. EnableDlgItem2(hDlg, IDE_TOOLBARBMP, FALSE);
  218. EnableDlgItem2(hDlg, IDC_BTOOLBARLIST, FALSE);
  219. EnableDlgItem2(hDlg, IDE_TOOLBARBMP, FALSE);
  220. CDlgRSoPData *pDRD = GetDlgRSoPData(hDlg, psCookie->pCS);
  221. if (pDRD)
  222. {
  223. if (0 == InitToolbarDlgInRSoPMode(hDlg, pDRD))
  224. EnableDlgItem2(hDlg, IDC_EDITBTOOLBAR, FALSE);
  225. else
  226. ListBox_SetCurSel(GetDlgItem(hDlg, IDC_BTOOLBARLIST), (WPARAM)0);
  227. }
  228. }
  229. else
  230. {
  231. if (0 == BToolbar_Init(GetDlgItem(hDlg, IDC_BTOOLBARLIST), GetInsFile(hDlg), NULL, NULL))
  232. {
  233. EnsureDialogFocus(hDlg, IDC_REMOVEBTOOLBAR, IDC_ADDBTOOLBAR);
  234. EnsureDialogFocus(hDlg, IDC_EDITBTOOLBAR, IDC_ADDBTOOLBAR);
  235. EnableDlgItem2(hDlg, IDC_EDITBTOOLBAR, FALSE);
  236. EnableDlgItem2(hDlg, IDC_REMOVEBTOOLBAR, FALSE);
  237. }
  238. else
  239. ListBox_SetCurSel(GetDlgItem(hDlg, IDC_BTOOLBARLIST), (WPARAM)0);
  240. ReadBoolAndCheckButton(IS_BTOOLBARS, IK_BTDELETE, FALSE, GetInsFile(hDlg), hDlg, IDC_DELETEBTOOLBARS);
  241. // ---- Toolbar background -------------------------------------------------------------------------
  242. InsGetString(IS_BRANDING, TOOLBAR_BMP, szToolbarBmp, countof(szToolbarBmp), GetInsFile(hDlg), NULL, &fToolbarBmp);
  243. SetDlgItemTextTriState(hDlg, IDE_TOOLBARBMP, IDC_BG_CUSTOM, szToolbarBmp, fToolbarBmp);
  244. CheckDlgButton(hDlg, IDC_BGIE6, fToolbarBmp ? BST_UNCHECKED : BST_CHECKED );
  245. EnableDlgItem2(hDlg, IDC_BROWSETBB, fToolbarBmp);
  246. }
  247. break;
  248. case WM_DESTROY:
  249. {
  250. if (psCookie->pCS->IsRSoP())
  251. DestroyDlgRSoPData(hDlg);
  252. HWND hwndList = GetDlgItem(hDlg, IDC_BTOOLBARLIST);
  253. PBTOOLBAR paBToolbar = (PBTOOLBAR)GetWindowLongPtr(hwndList, GWLP_USERDATA);
  254. if (NULL != paBToolbar)
  255. CoTaskMemFree(paBToolbar);
  256. break;
  257. }
  258. case WM_COMMAND:
  259. if (GET_WM_COMMAND_CMD(wParam, lParam) != BN_CLICKED)
  260. return FALSE;
  261. switch (GET_WM_COMMAND_ID(wParam, lParam))
  262. {
  263. case IDC_ADDBTOOLBAR:
  264. BToolbar_Edit(GetDlgItem(hDlg, IDC_BTOOLBARLIST), TRUE);
  265. break;
  266. case IDC_REMOVEBTOOLBAR:
  267. BToolbar_Remove(GetDlgItem(hDlg, IDC_BTOOLBARLIST));
  268. break;
  269. case IDC_EDITBTOOLBAR:
  270. {
  271. HWND hwndList = GetDlgItem(hDlg, IDC_BTOOLBARLIST);
  272. if (psCookie->pCS->IsRSoP())
  273. {
  274. int i = ListBox_GetCurSel(hwndList);
  275. PBTOOLBAR pBToolbar = (PBTOOLBAR)ListBox_GetItemData(hwndList, (WPARAM)i);
  276. if (pBToolbar != NULL)
  277. {
  278. DialogBoxParam( g_hUIInstance, MAKEINTRESOURCE(IDD_BTOOLBARPOPUP),
  279. GetParent(hwndList), editBToolbarRSoPProc, (LPARAM)pBToolbar );
  280. }
  281. }
  282. else
  283. BToolbar_Edit(hwndList, FALSE);
  284. break;
  285. }
  286. // ---- Toolbar background ---------------------------------------------------------------
  287. case IDC_BGIE6:
  288. case IDC_BG_CUSTOM:
  289. fToolbarBmp = IsDlgButtonChecked(hDlg,IDC_BG_CUSTOM);
  290. EnableDlgItem2(hDlg, IDE_TOOLBARBMP, fToolbarBmp);
  291. EnableDlgItem2(hDlg, IDC_BROWSETBB, fToolbarBmp);
  292. break;
  293. case IDC_BROWSETBB:
  294. GetDlgItemText(hDlg, IDE_TOOLBARBMP, szToolbarBmp, countof(szToolbarBmp));
  295. if (BrowseForFile(hDlg, szToolbarBmp, countof(szToolbarBmp), GFN_BMP))
  296. SetDlgItemText(hDlg, IDE_TOOLBARBMP, szToolbarBmp);
  297. break;
  298. default:
  299. return FALSE;
  300. }
  301. break;
  302. case WM_HELP: // F1
  303. ShowHelpTopic(hDlg);
  304. break;
  305. case WM_NOTIFY:
  306. switch (((LPNMHDR)lParam)->code)
  307. {
  308. TCHAR szMsgTitle[1024];
  309. TCHAR szMsgText[1024];
  310. int nStatus;
  311. case PSN_HELP:
  312. ShowHelpTopic(hDlg);
  313. break;
  314. case PSN_APPLY:
  315. if (psCookie->pCS->IsRSoP())
  316. {
  317. // On OK or Apply in RSoP mode, just free up memory for toolbar array - no
  318. // longer needed.
  319. HWND hwndList = GetDlgItem(hDlg, IDC_BTOOLBARLIST);
  320. if ((lpVoid = (LPVOID)GetWindowLongPtr(hwndList, GWLP_USERDATA)) != NULL)
  321. {
  322. CoTaskMemFree(lpVoid);
  323. SetWindowLongPtr(hwndList, GWLP_USERDATA, 0);
  324. }
  325. return FALSE;
  326. }
  327. else
  328. {
  329. // ---- Toolbar background -------------------------------------------------------------------------
  330. iBackground = IsDlgButtonChecked(hDlg, IDC_BGIE6) ? 0 : 2;
  331. fToolbarBmp = GetDlgItemTextTriState(hDlg, IDE_TOOLBARBMP, IDC_BG_CUSTOM, szToolbarBmp, countof(szToolbarBmp));
  332. if ((iBackground==2) && !IsBitmapFileValid(hDlg, IDE_TOOLBARBMP, szToolbarBmp, NULL, 0, 0, 0, 0))
  333. {
  334. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, -1);
  335. break;
  336. }
  337. IsTriStateValid(hDlg, IDE_TOOLBARBMP, IDC_BG_CUSTOM, &nStatus,
  338. res2Str(IDS_QUERY_CLEARSETTING, szMsgText, countof(szMsgText)),
  339. res2Str(IDS_TITLE, szMsgTitle, countof(szMsgTitle)));
  340. if (nStatus == TS_CHECK_ERROR || !AcquireWriteCriticalSection(hDlg))
  341. {
  342. SetWindowLongPtr(hDlg, DWLP_MSGRESULT, PSNRET_INVALID_NOCHANGEPAGE);
  343. break;
  344. }
  345. // ---- Toolbar buttons ----------------------------------------------------------------------------
  346. CreateWorkDir(GetInsFile(hDlg), IEAK_GPE_BRANDING_SUBDIR TEXT("\\TOOLBMP"), szWorkDir);
  347. // BUGBUG: <oliverl> revisit this in IE6 when we have server-side file
  348. // delete the old bitmap file
  349. InsGetString(IS_BRANDING, TOOLBAR_BMP, szTemp, countof(szTemp), GetInsFile(hDlg));
  350. if (*szTemp)
  351. DeleteFileInDir(szTemp, szWorkDir);
  352. // copy the new bitmap file
  353. if (fToolbarBmp && *szToolbarBmp)
  354. CopyFileToDir(szToolbarBmp, szWorkDir);
  355. if (PathIsDirectoryEmpty(szWorkDir))
  356. PathRemovePath(szWorkDir);
  357. InsWriteString(IS_BRANDING, TOOLBAR_BMP, szToolbarBmp, GetInsFile(hDlg),
  358. fToolbarBmp, NULL, INSIO_TRISTATE);
  359. CheckButtonAndWriteBool(hDlg, IDC_DELETEBTOOLBARS, IS_BTOOLBARS, IK_BTDELETE, GetInsFile(hDlg));
  360. CreateWorkDir(GetInsFile(hDlg), IEAK_GPE_BRANDING_SUBDIR TEXT("\\BTOOLBAR"), szWorkDir);
  361. BToolbar_Save(GetDlgItem(hDlg, IDC_BTOOLBARLIST), GetInsFile(hDlg), szWorkDir);
  362. SignalPolicyChanged(hDlg, FALSE, TRUE, &g_guidClientExt, &g_guidSnapinExt);
  363. }
  364. break;
  365. case PSN_QUERYCANCEL:
  366. // user canceled, need to free up memory for toolbar array
  367. if ((lpVoid = (LPVOID)GetWindowLongPtr(GetDlgItem(hDlg, IDC_BTOOLBARLIST), GWLP_USERDATA)) != NULL)
  368. {
  369. CoTaskMemFree(lpVoid);
  370. SetWindowLongPtr(GetDlgItem(hDlg, IDC_BTOOLBARLIST), GWLP_USERDATA, 0);
  371. }
  372. break;
  373. default:
  374. return FALSE;
  375. }
  376. break;
  377. default:
  378. return FALSE;
  379. }
  380. return TRUE;
  381. }
  382. /////////////////////////////////////////////////////////////////////
  383. HRESULT InitToolbarBmpPrecPage(CDlgRSoPData *pDRD, HWND hwndList)
  384. {
  385. return InitGenericPrecedencePage(pDRD, hwndList, L"toolbarBackgroundBitmapPath");
  386. }
  387. ///////////////////////////////////////////////////////////
  388. static INT_PTR CALLBACK editBToolbarRSoPProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  389. {
  390. PBTOOLBAR pBToolbar;
  391. switch (uMsg)
  392. {
  393. case WM_INITDIALOG:
  394. pBToolbar = (PBTOOLBAR)lParam;
  395. SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pBToolbar);
  396. EnableDBCSChars(hDlg, IDE_BTCAPTION);
  397. EnableDBCSChars(hDlg, IDE_BTACTION);
  398. EnableDBCSChars(hDlg, IDE_BTICON);
  399. EnableDBCSChars(hDlg, IDE_BTHOTICON);
  400. Edit_LimitText(GetDlgItem(hDlg, IDE_BTCAPTION), MAX_BTOOLBAR_TEXT_LENGTH);
  401. Edit_LimitText(GetDlgItem(hDlg, IDE_BTACTION), _MAX_FNAME);
  402. Edit_LimitText(GetDlgItem(hDlg, IDE_BTICON), _MAX_FNAME);
  403. Edit_LimitText(GetDlgItem(hDlg, IDE_BTHOTICON), _MAX_FNAME);
  404. SetDlgItemText(hDlg, IDE_BTCAPTION, pBToolbar->szCaption);
  405. SetDlgItemText(hDlg, IDE_BTACTION, pBToolbar->szAction);
  406. SetDlgItemText(hDlg, IDE_BTICON, pBToolbar->szIcon);
  407. SetDlgItemText(hDlg, IDE_BTHOTICON, pBToolbar->szHotIcon);
  408. CheckDlgButton(hDlg, IDC_BUTTONSTATE,
  409. pBToolbar->fShow ? BST_CHECKED : BST_UNCHECKED);
  410. EnableDlgItem2(hDlg, IDE_BTCAPTION, FALSE);
  411. EnableDlgItem2(hDlg, IDE_BTACTION, FALSE);
  412. EnableDlgItem2(hDlg, IDE_BTICON, FALSE);
  413. EnableDlgItem2(hDlg, IDE_BTHOTICON, FALSE);
  414. EnableDlgItem2(hDlg, IDC_BROWSEBTACTION, FALSE);
  415. EnableDlgItem2(hDlg, IDC_BROWSEBTICO, FALSE);
  416. EnableDlgItem2(hDlg, IDC_BROWSEBTHOTICO, FALSE);
  417. EnableDlgItem2(hDlg, IDC_BUTTONSTATE, FALSE);
  418. break;
  419. case WM_COMMAND:
  420. switch(HIWORD(wParam))
  421. {
  422. case BN_CLICKED:
  423. switch (LOWORD(wParam))
  424. {
  425. case IDCANCEL:
  426. EndDialog( hDlg, IDCANCEL );
  427. break;
  428. case IDHELP:
  429. ShowHelpTopic(hDlg);
  430. case IDOK:
  431. EndDialog( hDlg, IDOK );
  432. break;
  433. }
  434. break;
  435. }
  436. break;
  437. default:
  438. return FALSE;
  439. }
  440. return TRUE;
  441. }