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.

798 lines
19 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: uiutil.h
  8. //
  9. //--------------------------------------------------------------------------
  10. /////////////////////////////////////////////////////////////////////
  11. // UIUtil.h
  12. //
  13. // HISTORY
  14. // 08-Nov-99 JeffJon Creation.
  15. /////////////////////////////////////////////////////////////////////
  16. #ifndef __UIUTIL_H_
  17. #define __UIUTIL_H_
  18. #include "resource.h"
  19. #include <htmlhelp.h>
  20. /////////////////////////////////////////////////////////////////////
  21. // Forward Declarations
  22. //
  23. class CDSComponentData;
  24. /////////////////////////////////////////////////////////////////////////////
  25. // CHelpDialog
  26. class CHelpDialog : public CDialog
  27. {
  28. // Construction
  29. public:
  30. CHelpDialog(UINT uIDD, CWnd* pParentWnd);
  31. CHelpDialog(UINT uIDD);
  32. ~CHelpDialog();
  33. protected:
  34. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  35. DECLARE_MESSAGE_MAP()
  36. virtual void DoContextHelp (HWND hWndControl);
  37. afx_msg void OnWhatsThis();
  38. afx_msg BOOL OnHelp(WPARAM wParam, LPARAM lParam);
  39. private:
  40. HWND m_hWndWhatsThis;
  41. };
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CHelpPropertyPage
  44. class CHelpPropertyPage : public CPropertyPage
  45. {
  46. // Construction
  47. public:
  48. CHelpPropertyPage(UINT uIDD);
  49. ~CHelpPropertyPage();
  50. protected:
  51. afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
  52. DECLARE_MESSAGE_MAP()
  53. virtual void DoContextHelp (HWND hWndControl);
  54. afx_msg void OnWhatsThis();
  55. afx_msg BOOL OnHelp(WPARAM wParam, LPARAM lParam);
  56. private:
  57. HWND m_hWndWhatsThis;
  58. };
  59. /////////////////////////////////////////////////////////////////////
  60. // CDialogEx
  61. //
  62. class CDialogEx : public CDialog
  63. {
  64. public:
  65. CDialogEx(UINT nIDTemplate, CWnd * pParentWnd = NULL);
  66. HWND HGetDlgItem(INT nIdDlgItem);
  67. void SetDlgItemFocus(INT nIdDlgItem);
  68. void EnableDlgItem(INT nIdDlgItem, BOOL fEnable = TRUE);
  69. void HideDlgItem(INT nIdDlgItem, BOOL fHideItem = TRUE);
  70. };
  71. /////////////////////////////////////////////////////////////////////
  72. // CPropertyPageEx_Mine
  73. //
  74. class CPropertyPageEx_Mine : public CPropertyPage
  75. {
  76. public:
  77. CPropertyPageEx_Mine(UINT nIDTemplate);
  78. HWND HGetDlgItem(INT nIdDlgItem);
  79. void SetDlgItemFocus(INT nIdDlgItem);
  80. void EnableDlgItem(INT nIdDlgItem, BOOL fEnable = TRUE);
  81. void HideDlgItem(INT nIdDlgItem, BOOL fHideItem = TRUE);
  82. };
  83. ////////////////////////////////////////////////////////////////////////////////////
  84. // Error reporting helpers
  85. //
  86. void ReportError(HRESULT hr, int nStr, HWND hWnd);
  87. //
  88. // The message specified in dwMessageId must be in the DSADMIN module. It may
  89. // contain FormatMessage-style insertion strings. If lpArguments is specified,
  90. // then %1 and up are the arguments specified by lpArguments.
  91. // Return value and fuStyle are the same as for MessageBox.
  92. //
  93. int ReportMessageEx(HWND hWnd,
  94. DWORD dwMessageId,
  95. UINT fuStyle = MB_OK | MB_ICONINFORMATION,
  96. PVOID* lpArguments = NULL,
  97. int nArguments = 0,
  98. DWORD dwTitleId = 0,
  99. LPCTSTR pszHelpTopic = NULL,
  100. MSGBOXCALLBACK lpfnMsgBoxCallback = NULL );
  101. //
  102. // This is like ReportMessageEx except that %1 is the code for the HRESULT, and
  103. // %2 and up are the arguments specified by lpArguments (if any).
  104. //
  105. int ReportErrorEx(HWND hWnd,
  106. DWORD dwMessageId,
  107. HRESULT hr,
  108. UINT fuStyle = MB_OK | MB_ICONINFORMATION,
  109. PVOID* lpArguments = NULL,
  110. int nArguments = 0,
  111. DWORD dwTitleId = 0,
  112. BOOL TryADsIErrors = TRUE);
  113. const INT S_MB_YES_TO_ALL = 0x928L;
  114. int SpecialMessageBox (HWND hwnd,
  115. LPWSTR pwszMessage,
  116. LPWSTR pwszTitle,
  117. DWORD fuStyle = S_MB_YES_TO_ALL);
  118. ////////////////////////////////////////////////////////////////////////////
  119. // CMultiselectErrorDialog
  120. //
  121. class CMultiselectErrorDialog : public CDialog
  122. {
  123. public:
  124. CMultiselectErrorDialog(CDSComponentData* pComponentData)
  125. : m_pComponentData(pComponentData),
  126. m_pErrorArray(NULL),
  127. m_pPathArray(NULL),
  128. m_ppNodeList(NULL),
  129. m_nErrorCount(0),
  130. m_hImageList(NULL),
  131. CDialog(IDD_MULTISELECT_ERROR_DIALOG) {}
  132. ~CMultiselectErrorDialog() {}
  133. HRESULT Initialize(CUINode** ppNodeList,
  134. HRESULT* pErrorArray,
  135. UINT nErrorCount,
  136. PCWSTR pszTitle,
  137. PCWSTR pszCaption,
  138. PCWSTR pszHeader);
  139. HRESULT Initialize(PWSTR* pPathArray,
  140. PWSTR* pClassArray,
  141. HRESULT* pErrorArray,
  142. UINT nErrorCount,
  143. PCWSTR pszTitle,
  144. PCWSTR pszCaption,
  145. PCWSTR pszHeader);
  146. private:
  147. CMultiselectErrorDialog(const CMultiselectErrorDialog&) {}
  148. CMultiselectErrorDialog& operator=(const CMultiselectErrorDialog&) {}
  149. protected:
  150. void UpdateListboxHorizontalExtent();
  151. public:
  152. virtual BOOL OnInitDialog();
  153. DECLARE_MESSAGE_MAP()
  154. private:
  155. CDSComponentData* m_pComponentData;
  156. CUINode** m_ppNodeList;
  157. PWSTR* m_pPathArray;
  158. PWSTR* m_pClassArray;
  159. HRESULT* m_pErrorArray;
  160. UINT m_nErrorCount;
  161. CString m_szTitle;
  162. CString m_szCaption;
  163. CString m_szColumnHeader;
  164. HIMAGELIST m_hImageList;
  165. };
  166. /////////////////////////////////////////////////////////////////////////////
  167. // CProgressDialogBase
  168. //
  169. class CProgressDialogBase : public CDialog
  170. {
  171. public:
  172. static UINT s_nNextStepMessage;
  173. CProgressDialogBase(HWND hParentWnd);
  174. BOOL Aborted() { return !m_bDone; }
  175. void SetStepCount(UINT n)
  176. {
  177. ASSERT(n > 0);
  178. m_nSteps = n;
  179. }
  180. UINT GetStepCount() { return m_nSteps; }
  181. // Implementation
  182. protected:
  183. UINT m_nTitleStringID;
  184. // overrides
  185. virtual void OnStart()=0;
  186. virtual BOOL OnStep(UINT i)=0;
  187. virtual void OnEnd()=0;
  188. // message handlers
  189. virtual BOOL OnInitDialog();
  190. afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
  191. afx_msg void OnClose();
  192. afx_msg LONG OnNextStepMessage( WPARAM wParam, LPARAM lParam);
  193. private:
  194. CProgressCtrl m_progressCtrl;
  195. CString m_szProgressFormat;
  196. UINT m_nSteps; // number of steps to perform
  197. UINT m_nCurrStep; // current step, in range m_nSteps, 0
  198. BOOL m_bDone; // TRUE= reached completion
  199. void _SetProgressText();
  200. DECLARE_MESSAGE_MAP()
  201. };
  202. ////////////////////////////////////////////////////////////////////////
  203. // CMultipleDeletionConfirmationUI
  204. //
  205. class CMultipleDeletionConfirmationUI
  206. {
  207. public:
  208. CMultipleDeletionConfirmationUI()
  209. {
  210. m_hwnd = NULL;
  211. m_answerall = IDNO;
  212. m_answer = IDNO;
  213. }
  214. void SetWindow(HWND hwnd)
  215. {
  216. ASSERT(hwnd != NULL);
  217. m_hwnd = hwnd;
  218. }
  219. BOOL IsYesToAll() { return (m_answer == IDC_BUTTON_YESTOALL);}
  220. BOOL CanDeleteSubtree(HRESULT hr, LPCWSTR lpszName, BOOL* pbContinue)
  221. {
  222. *pbContinue = TRUE;
  223. if (m_answerall != IDC_BUTTON_YESTOALL)
  224. {
  225. PVOID apv[1] = {(LPWSTR)lpszName};
  226. m_answer = ReportErrorEx (m_hwnd,IDS_12_MULTI_OBJECT_HAS_CHILDREN,hr,
  227. S_MB_YES_TO_ALL | MB_ICONWARNING, apv, 1);
  228. if (m_answer == IDC_BUTTON_YESTOALL)
  229. {
  230. m_answerall = m_answer;
  231. m_answer = IDYES;
  232. }
  233. else if (m_answer == IDCANCEL)
  234. {
  235. m_answer = IDNO;
  236. *pbContinue = FALSE;
  237. }
  238. }
  239. else
  240. {
  241. m_answer = IDYES;
  242. }
  243. return m_answer == IDYES;
  244. }
  245. BOOL ErrorOnSubtreeDeletion(HRESULT hr, LPCWSTR lpszName)
  246. {
  247. if (m_answerall == IDC_BUTTON_YESTOALL)
  248. {
  249. return TRUE; // can continue, no need for asking
  250. }
  251. PVOID apv[1] = {(LPWSTR)lpszName};
  252. m_answer = ReportErrorEx (m_hwnd,IDS_12_SUBTREE_DELETE_FAILED,hr,
  253. MB_YESNO | MB_ICONINFORMATION, apv, 1);
  254. if (m_answer == IDNO)
  255. {
  256. return FALSE; // stop deletion process
  257. }
  258. return TRUE; // can continue
  259. }
  260. BOOL ErrorOnDeletion(HRESULT hr, LPCWSTR lpszName)
  261. {
  262. PVOID apv[1] = {(LPWSTR)lpszName};
  263. ReportErrorEx (m_hwnd,IDS_12_DELETE_FAILED,hr,
  264. MB_OK | MB_ICONERROR, apv, 1);
  265. if (m_answer == IDNO)
  266. {
  267. return FALSE; // stop deletion process
  268. }
  269. else
  270. {
  271. if (m_answer == IDC_BUTTON_YESTOALL)
  272. {
  273. m_answerall = m_answer;
  274. }
  275. }
  276. return TRUE; // can continue
  277. }
  278. private:
  279. HWND m_hwnd;
  280. UINT m_answerall;
  281. UINT m_answer;
  282. };
  283. ////////////////////////////////////////////////////////////////////////////
  284. // CMultipleProgressDialogBase
  285. //
  286. class CMultipleProgressDialogBase : public CProgressDialogBase
  287. {
  288. public:
  289. CMultipleProgressDialogBase(HWND hParentWnd, CDSComponentData* pComponentData)
  290. : m_phrArray(NULL),
  291. m_pPathArray(NULL),
  292. m_pClassArray(NULL),
  293. m_nErrorCount(0),
  294. m_pComponentData(pComponentData),
  295. CProgressDialogBase(hParentWnd)
  296. {
  297. }
  298. virtual ~CMultipleProgressDialogBase();
  299. HRESULT AddError(HRESULT hr,
  300. PCWSTR pszPath,
  301. PCWSTR pszClass);
  302. virtual void GetCaptionString(CString& szCaption) = 0;
  303. protected:
  304. virtual void OnEnd();
  305. CDSComponentData* m_pComponentData;
  306. CStringList m_szObjPathList;
  307. private:
  308. //
  309. // Error reporting structures
  310. //
  311. HRESULT* m_phrArray;
  312. PWSTR* m_pPathArray;
  313. PWSTR* m_pClassArray;
  314. UINT m_nErrorCount;
  315. };
  316. ////////////////////////////////////////////////////////////////////////////
  317. // CMultipleDeleteProgressDialog
  318. //
  319. class CMultipleDeleteHandlerBase;
  320. class CMultipleDeleteProgressDialog : public CMultipleProgressDialogBase
  321. {
  322. public:
  323. CMultipleDeleteProgressDialog(HWND hParentWnd,
  324. CDSComponentData* pComponentData,
  325. CMultipleDeleteHandlerBase* pDeleteHandler)
  326. : CMultipleProgressDialogBase(hParentWnd, pComponentData)
  327. {
  328. m_pDeleteHandler = pDeleteHandler;
  329. m_hWndOld = NULL;
  330. m_nTitleStringID = IDS_PROGRESS_DEL;
  331. }
  332. virtual void GetCaptionString(CString& szCaption)
  333. {
  334. VERIFY(szCaption.LoadString(IDS_MULTI_DELETE_ERROR_CAPTION));
  335. }
  336. protected:
  337. // overrides
  338. virtual void OnStart();
  339. virtual BOOL OnStep(UINT i);
  340. virtual void OnEnd();
  341. private:
  342. CMultipleDeleteHandlerBase* m_pDeleteHandler;
  343. HWND m_hWndOld;
  344. };
  345. /////////////////////////////////////////////////////////////////////////////
  346. // CMultipleMoveProgressDialog
  347. //
  348. class CMoveHandlerBase;
  349. class CMultipleMoveProgressDialog : public CMultipleProgressDialogBase
  350. {
  351. public:
  352. CMultipleMoveProgressDialog(HWND hParentWnd,
  353. CDSComponentData* pComponentData,
  354. CMoveHandlerBase* pMoveHandler)
  355. : CMultipleProgressDialogBase(hParentWnd, pComponentData)
  356. {
  357. m_pMoveHandler = pMoveHandler;
  358. m_hWndOld = NULL;
  359. m_nTitleStringID = IDS_PROGRESS_MOV;
  360. }
  361. virtual void GetCaptionString(CString& szCaption)
  362. {
  363. VERIFY(szCaption.LoadString(IDS_MULTI_MOVE_ERROR_CAPTION));
  364. }
  365. protected:
  366. // overrides
  367. virtual void OnStart();
  368. virtual BOOL OnStep(UINT i);
  369. virtual void OnEnd();
  370. private:
  371. CMoveHandlerBase* m_pMoveHandler;
  372. HWND m_hWndOld;
  373. };
  374. //////////////////////////////////////////////////////////////////
  375. // CMoreInfoMessageBox
  376. //
  377. class CMoreInfoMessageBox : public CDialog
  378. {
  379. public:
  380. CMoreInfoMessageBox(HWND hWndParent, IDisplayHelp* pIDisplayHelp, BOOL bCancelBtn)
  381. : CDialog(bCancelBtn ? IDD_MSGBOX_OKCANCEL_MOREINFO : IDD_MSGBOX_OK_MOREINFO,
  382. CWnd::FromHandle(hWndParent)),
  383. m_spIDisplayHelp(pIDisplayHelp)
  384. {
  385. }
  386. void SetURL(LPCWSTR lpszURL) { m_szURL = lpszURL;}
  387. void SetMessage(LPCWSTR lpsz)
  388. {
  389. m_szMessage = lpsz;
  390. }
  391. // message handlers and MFC overrides
  392. virtual BOOL OnInitDialog()
  393. {
  394. SetDlgItemText(IDC_STATIC_MESSAGE, m_szMessage);
  395. return TRUE;
  396. }
  397. afx_msg void OnMoreInfo()
  398. {
  399. TRACE(L"ShowTopic(%s)\n", (LPCWSTR)m_szURL);
  400. HRESULT hr = m_spIDisplayHelp->ShowTopic((LPWSTR)(LPCWSTR)m_szURL);
  401. if( hr != S_OK )
  402. {
  403. HtmlHelp( NULL,
  404. (LPCWSTR)m_szURL,
  405. HH_DISPLAY_TOPIC,
  406. NULL );
  407. }
  408. }
  409. DECLARE_MESSAGE_MAP()
  410. private:
  411. CComPtr<IDisplayHelp> m_spIDisplayHelp;
  412. CString m_szMessage;
  413. CString m_szURL;
  414. };
  415. /////////////////////////////////////////////////////////////////////////////
  416. // CMoveServerDialog
  417. //
  418. class CMoveServerDialog : public CDialog
  419. {
  420. public:
  421. CMoveServerDialog(LPCTSTR lpcszBrowseRootPath, HICON hIcon, CWnd* pParent = NULL);
  422. // Dialog Data
  423. //{{AFX_DATA(CMoveServerDialog)
  424. enum { IDD = IDD_MOVE_SERVER };
  425. CString m_strServer;
  426. //}}AFX_DATA
  427. CString m_strTargetContainer;
  428. CString m_strBrowseRootPath;
  429. // Implementation
  430. protected:
  431. // message handlers
  432. virtual BOOL OnInitDialog();
  433. virtual void OnOK();
  434. void OnDblclkListview(NMHDR* pNMHDR, LRESULT* pResult) ;
  435. // CWnd overrides
  436. afx_msg
  437. void
  438. OnDestroy();
  439. private:
  440. HICON m_hIcon;
  441. HWND listview;
  442. HIMAGELIST listview_imagelist;
  443. DECLARE_MESSAGE_MAP()
  444. };
  445. /////////////////////////////////////////////////////////////////////////////
  446. // CConfirmOperationDialog
  447. //
  448. class CDSNotifyHandlerTransaction;
  449. class CConfirmOperationDialog : public CDialog
  450. {
  451. public:
  452. CConfirmOperationDialog(HWND hParentWnd, CDSNotifyHandlerTransaction* pTransaction);
  453. void SetStrings(LPCWSTR lpszOperation, LPCWSTR lpszAssocData)
  454. {
  455. m_lpszOperation = lpszOperation;
  456. m_lpszAssocData = lpszAssocData;
  457. }
  458. // Implementation
  459. protected:
  460. // overrides
  461. // message handlers
  462. virtual BOOL OnInitDialog();
  463. void UpdateListBoxHorizontalExtent();
  464. virtual void OnCancel()
  465. {
  466. EndDialog(IDNO);
  467. }
  468. afx_msg void OnYes();
  469. afx_msg void OnNo()
  470. {
  471. EndDialog(IDNO);
  472. }
  473. private:
  474. UINT m_nTitleStringID;
  475. LPCWSTR m_lpszOperation;
  476. LPCWSTR m_lpszAssocData;
  477. CDSNotifyHandlerTransaction* m_pTransaction;
  478. CCheckListBox m_extensionsList;
  479. DECLARE_MESSAGE_MAP()
  480. };
  481. ///////////////////////////////////////////////////////////////////////////
  482. // Name Formating classes
  483. //
  484. // CNameFormatterBase
  485. class CNameFormatterBase
  486. {
  487. private:
  488. class CToken
  489. {
  490. public:
  491. CToken()
  492. {
  493. m_bIsParam = FALSE;
  494. m_nIndex = -1;
  495. }
  496. BOOL m_bIsParam;
  497. INT m_nIndex;
  498. };
  499. public:
  500. CNameFormatterBase()
  501. {
  502. _Init();
  503. }
  504. virtual ~CNameFormatterBase()
  505. {
  506. _Clear();
  507. }
  508. HRESULT Initialize(IN MyBasePathsInfo* pBasePathInfo,
  509. IN LPCWSTR lpszClassName,
  510. IN UINT nStringID);
  511. BOOL Initialize(IN LPCWSTR lpszFormattingString);
  512. void SetMapping(IN LPCWSTR* lpszArgMapping, IN int nArgCount);
  513. void Format(OUT CString& szBuffer, IN LPCWSTR* lpszArgArr);
  514. private:
  515. static HRESULT _ReadFromDS(IN MyBasePathsInfo* pBasePathInfo,
  516. IN LPCWSTR lpszClassName,
  517. OUT CString& szFormatString);
  518. void _Init()
  519. {
  520. m_lpszFormattingString = NULL;
  521. m_tokenArray = NULL;
  522. m_lpszConstArr = NULL;
  523. m_lpszParamArr = NULL;
  524. m_mapArr = NULL;
  525. m_tokenArrCount = 0;
  526. m_constArrCount = 0;
  527. m_paramArrCount = 0;
  528. }
  529. void _Clear()
  530. {
  531. if (m_lpszFormattingString != NULL)
  532. {
  533. delete[] m_lpszFormattingString;
  534. m_lpszFormattingString = 0;
  535. }
  536. if (m_tokenArray != NULL)
  537. {
  538. delete[] m_tokenArray;
  539. m_tokenArray = 0;
  540. m_tokenArrCount = 0;
  541. }
  542. if (m_constArrCount != 0 && m_lpszConstArr)
  543. {
  544. delete[] m_lpszConstArr;
  545. m_lpszConstArr = 0;
  546. m_constArrCount = 0;
  547. }
  548. if (m_paramArrCount != 0 && m_lpszParamArr)
  549. {
  550. delete[] m_lpszParamArr;
  551. m_lpszParamArr = 0;
  552. m_paramArrCount = 0;
  553. }
  554. if (m_mapArr != NULL)
  555. {
  556. delete[] m_mapArr;
  557. m_mapArr = 0;
  558. }
  559. }
  560. void _AllocateMemory(LPCWSTR lpszFormattingString);
  561. LPWSTR m_lpszFormattingString;
  562. CToken* m_tokenArray;
  563. LPCWSTR* m_lpszConstArr;
  564. LPCWSTR* m_lpszParamArr;
  565. int* m_mapArr;
  566. int m_tokenArrCount;
  567. int m_constArrCount;
  568. int m_paramArrCount;
  569. };
  570. class CUserNameFormatter : public CNameFormatterBase
  571. {
  572. public:
  573. HRESULT Initialize(IN MyBasePathsInfo* pBasePathInfo,
  574. IN LPCWSTR lpszClassName)
  575. {
  576. static LPCWSTR lpszMapping[] = {L"givenName", L"initials", L"sn"};
  577. static const int nArgs = 3;
  578. HRESULT hr = CNameFormatterBase::Initialize(pBasePathInfo,
  579. lpszClassName,
  580. IDS_FORMAT_USER_NAME);
  581. if (FAILED(hr))
  582. {
  583. return hr;
  584. }
  585. SetMapping(lpszMapping, nArgs);
  586. return S_OK;
  587. }
  588. void FormatName(OUT CString& szBuffer,
  589. IN LPCWSTR lpszFirstName,
  590. IN LPCWSTR lpszInitials,
  591. IN LPCWSTR lpszLastName)
  592. {
  593. LPCWSTR lpszArgs[3];
  594. lpszArgs[0] = lpszFirstName;
  595. lpszArgs[1] = lpszInitials;
  596. lpszArgs[2] = lpszLastName;
  597. CNameFormatterBase::Format(szBuffer, lpszArgs);
  598. }
  599. };
  600. /////////////////////////////////////////////////////////////////////
  601. // List View utilities
  602. //
  603. struct TColumnHeaderItem
  604. {
  605. UINT uStringId; // Resource Id of the string
  606. INT nColWidth; // % of total width of the column (0 = autowidth, -1 = fill rest of space)
  607. };
  608. void ListView_AddColumnHeaders(HWND hwndListview,
  609. const TColumnHeaderItem rgzColumnHeader[]);
  610. int ListView_AddString(HWND hwndListview,
  611. const LPCTSTR psz,
  612. LPARAM lParam = 0);
  613. int ListView_AddStrings(HWND hwndListview,
  614. const LPCTSTR rgzpsz[],
  615. LPARAM lParam = 0);
  616. void ListView_SelectItem(HWND hwndListview, int iItem);
  617. int ListView_GetSelectedItem(HWND hwndListview);
  618. int ListView_FindString(HWND hwndListview, LPCTSTR szTextSearch);
  619. void ListView_SetItemString(HWND hwndListview,
  620. int iItem,
  621. int iSubItem,
  622. IN const CString& rstrText);
  623. int ListView_GetItemString(HWND hwndListview,
  624. int iItem,
  625. int iSubItem,
  626. OUT CString& rstrText);
  627. LPARAM ListView_GetItemLParam(HWND hwndListview,
  628. int iItem,
  629. OUT int * piItem = NULL);
  630. int ListView_FindLParam(HWND hwndListview,
  631. LPARAM lParam);
  632. int ListView_SelectLParam(HWND hwndListview,
  633. LPARAM lParam);
  634. /////////////////////////////////////////////////////////////////////
  635. // Dialog Utilities
  636. //
  637. HWND HGetDlgItem(HWND hdlg, INT nIdDlgItem);
  638. void SetDlgItemFocus(HWND hdlg, INT nIdDlgItem);
  639. void EnableDlgItem(HWND hdlg, INT nIdDlgItem, BOOL fEnable = TRUE);
  640. void HideDlgItem(HWND hdlg, INT nIdDlgItem, BOOL fHideItem = TRUE);
  641. void EnableDlgItemGroup(HWND hdlg,
  642. const UINT rgzidCtl[],
  643. BOOL fEnableAll = TRUE);
  644. void HideDlgItemGroup(HWND hdlg,
  645. const UINT rgzidCtl[],
  646. BOOL fHideAll = TRUE);
  647. //////////////////////////////////////////////////////////////////////
  648. // Combo box Utilities
  649. //
  650. int ComboBox_AddString(HWND hwndCombobox, UINT uStringId);
  651. void ComboBox_AddStrings(HWND hwndCombobox, const UINT rgzuStringId[]);
  652. int ComboBox_FindItemByLParam(HWND hwndComboBox, LPARAM lParam);
  653. int ComboBox_SelectItemByLParam(HWND hwndComboBox, LPARAM lParam);
  654. LPARAM ComboBox_GetSelectedItemLParam(HWND hwndComboBox);
  655. #endif // __UIUTIL_H_