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.

186 lines
4.6 KiB

  1. /*++
  2. Module Name:
  3. Connect.h
  4. Abstract:
  5. This module contains the declaration for CConnectToDialog.
  6. This class is used to display the Connect To Dfs Root dialog box
  7. --*/
  8. #ifndef __CONNECT_H_
  9. #define __CONNECT_H_
  10. #include "resource.h" // Main resource symbols
  11. #include "NetUtils.h"
  12. #include "DfsGUI.h"
  13. #include "DfsCore.h"
  14. #include "bufmgr.h"
  15. typedef enum _ICONTYPE
  16. {
  17. ICONTYPE_BUSY = 0,
  18. ICONTYPE_ERROR,
  19. ICONTYPE_NORMAL
  20. } ICONTYPE;
  21. /////////////////////////////////////////////////////////////////////////////
  22. // CConnectToDialog
  23. class CConnectToDialog :
  24. public CDialogImpl<CConnectToDialog>
  25. {
  26. private:
  27. // This method is started the starting point of the second thread
  28. //friend DWORD WINAPI HelperThreadEntryPoint(IN LPVOID i_pvThisPointer);
  29. private:
  30. // IDC_TREEDFSRoots is the resource id of the TV. Internally we useS IDC_TV only
  31. enum { IDC_TV = IDC_TREEDFSRoots };
  32. // The Edit box in the ConnectTo dialog
  33. enum {IDC_DLG_EDIT = IDC_EditDfsRoot};
  34. public:
  35. CConnectToDialog();
  36. ~CConnectToDialog();
  37. // IDD_DLGCONNECTTO is the dialog id. This is used by CDialogImpl.
  38. enum { IDD = IDD_DLGCONNECTTO };
  39. BEGIN_MSG_MAP(CDlgConnectTo)
  40. MESSAGE_HANDLER(WM_USER_GETDATA_THREAD_DONE, OnGetDataThreadDone)
  41. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  42. MESSAGE_HANDLER(WM_HELP, OnCtxHelp)
  43. MESSAGE_HANDLER(WM_CONTEXTMENU, OnCtxMenuHelp)
  44. MESSAGE_HANDLER(WM_NOTIFY, OnNotify)
  45. COMMAND_ID_HANDLER(IDOK, OnOK)
  46. COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
  47. END_MSG_MAP()
  48. // Not implemented
  49. private:
  50. CConnectToDialog(const CConnectToDialog& Obj);
  51. const CConnectToDialog& operator=(const CConnectToDialog& rhs);
  52. public:
  53. // Message handlers
  54. LRESULT OnGetDataThreadDone(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  55. void ExpandNodeErrorReport(
  56. IN HTREEITEM hItem,
  57. IN PCTSTR pszNodeName,
  58. IN HRESULT hr
  59. );
  60. void ExpandNode(
  61. IN PCTSTR pszNodeName,
  62. IN NODETYPE nNodeType,
  63. IN HTREEITEM hParentItem
  64. );
  65. HRESULT InsertData(
  66. IN CEntryData *pEntry,
  67. IN HTREEITEM hParentItem
  68. );
  69. LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  70. LRESULT OnCtxHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  71. LRESULT OnCtxMenuHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  72. // Used to get the notification about changing of TV's selection.
  73. LRESULT OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  74. LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  75. LRESULT OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  76. public:
  77. // Return the item selected by the user
  78. STDMETHOD(get_DfsRoot)(OUT BSTR *pVal);
  79. // Helper Methods
  80. private:
  81. // Notify helpers
  82. // Handle the
  83. LRESULT DoNotifyDoubleClick(
  84. );
  85. // Handle the TVN_ITEMEXPANDING notify for the Tree View
  86. LRESULT DoNotifyItemExpanding(
  87. IN LPNM_TREEVIEW i_pNMTreeView
  88. );
  89. // Handle the TVN_SELCHANGED notify for the Tree View
  90. LRESULT DoNotifySelectionChanged(
  91. IN LPNM_TREEVIEW i_pNMTreeView
  92. );
  93. // Initilization routines
  94. // Create the imagelist and initialize it.
  95. HRESULT InitTVImageList();
  96. // Add the items to the Tree View. This includes the domain names and the
  97. // StandAlone subtree label
  98. HRESULT FillupTheTreeView(
  99. );
  100. // Set the cChilren label to zero for this tree item
  101. void SetChildrenToZero(
  102. IN HTREEITEM i_hItem
  103. );
  104. HRESULT AddSingleItemtoTV(
  105. IN const BSTR i_bstrItemLabel,
  106. IN const int i_iImageIndex,
  107. IN const int i_iImageSelectedIndex,
  108. IN const bool i_bChildren,
  109. IN const NODETYPE i_NodeType,
  110. IN HTREEITEM i_hItemParent = NULL
  111. );
  112. void ChangeIcon(
  113. IN HTREEITEM hItem,
  114. IN ICONTYPE IconType
  115. );
  116. HRESULT GetNodeInfo(
  117. IN HTREEITEM hItem,
  118. OUT BSTR* o_bstrName,
  119. OUT NODETYPE* pNodeType
  120. );
  121. // Overiding the method of CDialogImpl.
  122. BOOL EndDialog(IN int i_RetCode);
  123. // Data members
  124. private:
  125. CBufferManager *m_pBufferManager;
  126. CComBSTR m_bstrDfsRoot; // Store the selected Dfs Root here
  127. HIMAGELIST m_hImageList; // The TV imagelist handle
  128. NETNAMELIST m_50DomainList; // Pointer to the first 50 domain information
  129. CComBSTR m_bstrDomainDfsRootsLabel;
  130. CComBSTR m_bstrAllDfsRootsLabel;
  131. };
  132. #endif //__CONNECTTODIALOG_H_