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.

183 lines
5.8 KiB

  1. /////////////////////////////////////////////////////////////////////
  2. // Chooser.h
  3. //
  4. // HISTORY
  5. // 13-May-1997 t-danm Creation.
  6. //
  7. /////////////////////////////////////////////////////////////////////
  8. #ifndef __CHOOSER_H_INCLUDED__
  9. #define __CHOOSER_H_INCLUDED__
  10. LPCTSTR PchGetMachineNameOverride();
  11. #include "choosert.h" // Temporary IDs
  12. #include "chooserd.h" // Default IDs
  13. ///////////////////////////////////////////////////////////////////////////////
  14. // Generic method for launching a single-select computer picker
  15. //
  16. // Paremeters:
  17. // hwndParent (IN) - window handle of parent window
  18. // computerName (OUT) - computer name returned
  19. //
  20. // Returns S_OK if everything succeeded, S_FALSE if user pressed "Cancel"
  21. //
  22. //////////////////////////////////////////////////////////////////////////////
  23. HRESULT ComputerNameFromObjectPicker (HWND hwndParent, CString& computerName);
  24. /////////////////////////////////////////////////////////////////////
  25. /////////////////////////////////////////////////////////////////////
  26. // class CAutoDeletePropPage
  27. //
  28. // This object is the backbone for property page
  29. // that will *destroy* itself when no longer needed.
  30. // The purpose of this object is to maximize code reuse
  31. // among the various pages in the snapin wizards.
  32. //
  33. // INHERITANCE TREE (so far)
  34. // CAutoDeletePropPage - Base object
  35. // CChooseMachinePropPage - Dialog to select a machine name
  36. // CFileMgmtGeneral - Dialog to select "File Services" (snapin\filemgmt\snapmgr.h)
  37. // CMyComputerGeneral - Dialog for the "My Computer" (snapin\mycomput\snapmgr.h)
  38. // CChoosePrototyperPropPage - Dialog to select prototyper demo (NYI)
  39. //
  40. // HISTORY
  41. // 15-May-1997 t-danm Creation. Split of CChooseMachinePropPage
  42. // to allow property pages to have more flexible dialog
  43. // templates.
  44. //
  45. class CAutoDeletePropPage : public CPropertyPage
  46. {
  47. public:
  48. // Construction
  49. CAutoDeletePropPage(UINT uIDD);
  50. virtual ~CAutoDeletePropPage();
  51. protected:
  52. // Dialog Data
  53. //{{AFX_DATA(CAutoDeletePropPage)
  54. //}}AFX_DATA
  55. // Overrides
  56. // ClassWizard generate virtual function overrides
  57. //{{AFX_VIRTUAL(CAutoDeletePropPage)
  58. virtual BOOL OnSetActive();
  59. //}}AFX_VIRTUAL
  60. // Implementation
  61. protected:
  62. // Generated message map functions
  63. //{{AFX_MSG(CAutoDeletePropPage)
  64. afx_msg BOOL OnHelp(WPARAM wParam, LPARAM lParam);
  65. afx_msg BOOL OnContextHelp(WPARAM wParam, LPARAM lParam);
  66. //}}AFX_MSG
  67. DECLARE_MESSAGE_MAP()
  68. // This mechanism deletes the CAutoDeletePropPage object
  69. // when the wizard is finished
  70. struct
  71. {
  72. INT cWizPages; // Number of pages in wizard
  73. LPFNPSPCALLBACK pfnOriginalPropSheetPageProc;
  74. } m_autodeleteStuff;
  75. static UINT CALLBACK S_PropSheetPageProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
  76. protected:
  77. CString m_strHelpFile; // Name for the .hlp file
  78. const DWORD * m_prgzHelpIDs; // Optional: Pointer to an array of help IDs
  79. public:
  80. /////////////////////////////////////////////////////////////////////
  81. void SetCaption(UINT uStringID);
  82. void SetCaption(LPCTSTR pszCaption);
  83. void SetHelp(LPCTSTR szHelpFile, const DWORD rgzHelpIDs[]);
  84. void EnableDlgItem(INT nIdDlgItem, BOOL fEnable);
  85. }; // CAutoDeletePropPage
  86. /////////////////////////////////////////////////////////////////////
  87. /////////////////////////////////////////////////////////////////////
  88. // class CChooseMachinePropPage
  89. //
  90. // This object is a stand-alone property page used to
  91. // select a computer name.
  92. //
  93. // The object CChooseMachinePropPage can have its dialog
  94. // template replaced to allow a new wizard without any new code.
  95. // The object can also be inherited, allowing easy extentionability.
  96. //
  97. // RESTRICTIONS:
  98. // If the user wishes to provide its own dialog template, here
  99. // are the dialog IDs that must present:
  100. // IDC_CHOOSER_RADIO_LOCAL_MACHINE - Select local machine.
  101. // IDC_CHOOSER_RADIO_SPECIFIC_MACHINE - Select a specific machine.
  102. // IDC_CHOOSER_EDIT_MACHINE_NAME - Edit field to enter the machine name.
  103. // There are also optional IDs:
  104. // IDC_CHOOSER_BUTTON_BROWSE_MACHINENAMES - Browse to select a machine name.
  105. // IDC_CHOOSER_CHECK_OVERRIDE_MACHINE_NAME - Checkbox to allow the machine name to be overriden by command line.
  106. //
  107. class CChooseMachinePropPage : public CAutoDeletePropPage
  108. {
  109. public:
  110. enum { IID_DEFAULT = IDD_CHOOSER_CHOOSE_MACHINE };
  111. public:
  112. // Construction
  113. CChooseMachinePropPage(UINT uIDD = IID_DEFAULT);
  114. virtual ~CChooseMachinePropPage();
  115. protected:
  116. void InitRadioButtons();
  117. // Dialog Data
  118. //{{AFX_DATA(CChooseMachinePropPage)
  119. enum { IDD = IDD_CHOOSER_CHOOSE_MACHINE };
  120. BOOL m_fIsRadioLocalMachine; // TRUE => Local Machine is selected
  121. BOOL m_fAllowOverrideMachineName; // TRUE => Machine name can be overriden from command line
  122. CString m_strMachineName;
  123. //}}AFX_DATA
  124. // Overrides
  125. // ClassWizard generate virtual function overrides
  126. //{{AFX_VIRTUAL(CChooseMachinePropPage)
  127. public:
  128. virtual BOOL OnWizardFinish();
  129. protected:
  130. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  131. //}}AFX_VIRTUAL
  132. // Implementation
  133. protected:
  134. // Generated message map functions
  135. //{{AFX_MSG(CChooseMachinePropPage)
  136. virtual BOOL OnInitDialog();
  137. afx_msg void OnRadioLocalMachine();
  138. afx_msg void OnRadioSpecificMachine();
  139. afx_msg void OnChooserButtonBrowseMachinenames();
  140. //}}AFX_MSG
  141. DECLARE_MESSAGE_MAP()
  142. HWND m_hwndCheckboxOverride;
  143. protected:
  144. BOOL * m_pfAllowOverrideMachineNameOut; // OUT: Pointer to BOOL receiving flag wherever to override machine name
  145. CString * m_pstrMachineNameOut; // OUT: Pointer to the CString object to store the machine name
  146. CString * m_pstrMachineNameEffectiveOut; // OUT: Pointer to the CString object to store the effective machine name
  147. public:
  148. void InitMachineName(LPCTSTR pszMachineName);
  149. void SetOutputBuffers(
  150. OUT CString * pstrMachineNamePersist,
  151. OUT OPTIONAL BOOL * pfAllowOverrideMachineName,
  152. OUT OPTIONAL CString * pstrMachineNameEffective);
  153. }; // CChooseMachinePropPage
  154. #endif // ~__CHOOSER_H_INCLUDED__