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.

274 lines
8.3 KiB

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
  3. Begin VB.Form Form1
  4. Caption = "Form1"
  5. ClientHeight = 6585
  6. ClientLeft = 1080
  7. ClientTop = 1440
  8. ClientWidth = 8685
  9. LinkTopic = "Form1"
  10. PaletteMode = 1 'UseZOrder
  11. ScaleHeight = 6585
  12. ScaleWidth = 8685
  13. Begin VB.CommandButton cmdPropTest
  14. Caption = "Add Props"
  15. Enabled = 0 'False
  16. Height = 495
  17. Left = 5040
  18. TabIndex = 9
  19. Top = 360
  20. Visible = 0 'False
  21. Width = 1215
  22. End
  23. Begin VB.CheckBox checkReadOnly
  24. Caption = "Read Only"
  25. Height = 495
  26. Left = 6000
  27. TabIndex = 8
  28. Top = 1320
  29. Width = 1215
  30. End
  31. Begin VB.CheckBox checkPrivate
  32. Caption = "Private"
  33. Height = 495
  34. Left = 3480
  35. TabIndex = 7
  36. Top = 1320
  37. Width = 1215
  38. End
  39. Begin ComctlLib.ListView PropView
  40. Height = 4455
  41. Left = 3480
  42. TabIndex = 6
  43. Top = 1920
  44. Width = 4575
  45. _ExtentX = 8070
  46. _ExtentY = 7858
  47. View = 3
  48. LabelWrap = -1 'True
  49. HideSelection = -1 'True
  50. _Version = 327680
  51. ForeColor = -2147483640
  52. BackColor = -2147483643
  53. BorderStyle = 1
  54. Appearance = 1
  55. NumItems = 2
  56. BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
  57. Key = ""
  58. Object.Tag = ""
  59. Text = "Name"
  60. Object.Width = 2540
  61. EndProperty
  62. BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
  63. SubItemIndex = 1
  64. Key = ""
  65. Object.Tag = ""
  66. Text = "Value"
  67. Object.Width = 2540
  68. EndProperty
  69. End
  70. Begin ComctlLib.TreeView ClusTree
  71. Height = 4935
  72. Left = 240
  73. TabIndex = 5
  74. Top = 1440
  75. Width = 2895
  76. _ExtentX = 5106
  77. _ExtentY = 8705
  78. _Version = 327680
  79. HideSelection = 0 'False
  80. Indentation = 353
  81. LabelEdit = 1
  82. LineStyle = 1
  83. Style = 6
  84. Appearance = 1
  85. End
  86. Begin VB.CommandButton cmdTest
  87. Caption = "&Test"
  88. Height = 375
  89. Left = 3240
  90. TabIndex = 2
  91. Top = 360
  92. Width = 1215
  93. End
  94. Begin VB.TextBox txtServerName
  95. Height = 285
  96. Left = 1800
  97. TabIndex = 1
  98. Text = "stacyh1"
  99. Top = 360
  100. Width = 1215
  101. End
  102. Begin VB.Label lblQuorumResource
  103. Caption = "txtQuorumResource"
  104. Height = 255
  105. Left = 1800
  106. TabIndex = 4
  107. Top = 840
  108. Width = 1215
  109. End
  110. Begin VB.Label Label3
  111. Caption = "Quorum Resource"
  112. Height = 255
  113. Left = 120
  114. TabIndex = 3
  115. Top = 840
  116. Width = 1455
  117. End
  118. Begin VB.Label Label1
  119. Caption = "Cluster Server"
  120. Height = 255
  121. Left = 120
  122. TabIndex = 0
  123. Top = 360
  124. Width = 1215
  125. End
  126. End
  127. Attribute VB_Name = "Form1"
  128. Attribute VB_GlobalNameSpace = False
  129. Attribute VB_Creatable = False
  130. Attribute VB_PredeclaredId = True
  131. Attribute VB_Exposed = False
  132. Option Explicit
  133. Dim oClusterApp As New MSClusterLib.Application
  134. Dim oCluster As New Cluster
  135. Private Sub checkPrivate_Click()
  136. ClusTree_NodeClick ClusTree.SelectedItem
  137. End Sub
  138. Private Sub checkReadOnly_Click()
  139. ClusTree_NodeClick ClusTree.SelectedItem
  140. End Sub
  141. Private Sub ClusTree_NodeClick(ByVal Node As ComctlLib.Node)
  142. On Error GoTo error_exit
  143. Select Case Node.Tag
  144. Case "Node"
  145. Dim oNode As ClusNode
  146. Set oNode = oCluster.Nodes(Node.Key)
  147. If checkReadOnly Then
  148. If checkPrivate Then
  149. ListProperties oNode.PrivateROProperties, PropView
  150. Else
  151. ListProperties oNode.CommonROProperties, PropView
  152. End If
  153. Else
  154. If checkPrivate Then
  155. ListProperties oNode.PrivateProperties, PropView
  156. Else
  157. ListProperties oNode.CommonProperties, PropView
  158. End If
  159. End If
  160. Case "Group"
  161. Dim oGroup As ClusResGroup
  162. Set oGroup = oCluster.ResourceGroups(Node.Key)
  163. If checkReadOnly Then
  164. If checkPrivate Then
  165. ListProperties oGroup.PrivateROProperties, PropView
  166. Else
  167. ListProperties oGroup.CommonROProperties, PropView
  168. End If
  169. Else
  170. If checkPrivate Then
  171. ListProperties oGroup.PrivateProperties, PropView
  172. Else
  173. ListProperties oGroup.CommonProperties, PropView
  174. End If
  175. End If
  176. Case "Resource"
  177. Dim res As ClusResource
  178. Set res = oCluster.Resources(Node.Key)
  179. If checkReadOnly Then
  180. If checkPrivate Then
  181. ListProperties res.PrivateROProperties, PropView
  182. Else
  183. ListProperties res.CommonROProperties, PropView
  184. End If
  185. Else
  186. If checkPrivate Then
  187. ListProperties res.PrivateProperties, PropView
  188. Else
  189. ListProperties res.CommonProperties, PropView
  190. End If
  191. End If
  192. Case "Type"
  193. Dim ResType As ClusResType
  194. Set ResType = oCluster.ResourceTypes(Node.Text)
  195. If checkReadOnly Then
  196. If checkPrivate Then
  197. ListProperties ResType.PrivateROProperties, PropView
  198. Else
  199. ListProperties ResType.CommonROProperties, PropView
  200. End If
  201. Else
  202. If checkPrivate Then
  203. ListProperties ResType.PrivateProperties, PropView
  204. Else
  205. ListProperties ResType.CommonProperties, PropView
  206. End If
  207. End If
  208. Case Else
  209. PropView.ListItems.Clear
  210. End Select
  211. Exit Sub
  212. error_exit:
  213. End Sub
  214. Private Sub cmdPropTest_Click()
  215. Dim oResource As ClusResource
  216. Set oResource = oCluster.Resources("SomeApp")
  217. oCluster.ResourceGroups.CreateItem "Fooey"
  218. oCluster.ResourceGroups.CreateItem "Fooey"
  219. '----------------------------------------
  220. ' Set some properties on the resource
  221. '----------------------------------------
  222. Dim Props As ClusProperties
  223. Set Props = oResource.PrivateProperties
  224. Props.Add "CommandLine", "c:\winnt\system32\notepad.exe"
  225. Props.Add "CurrentDirectory", "c:\"
  226. Props.Add "InteractWithDesktop", 1
  227. oResource.PrivateProperties.SaveChanges
  228. End Sub
  229. Private Sub cmdTest_Click()
  230. ClusTree.Nodes.Clear
  231. ListTheClusters oClusterApp, ClusTree
  232. 'Open the cluster specified
  233. oCluster.Open txtServerName.Text
  234. 'Display quorum resource name
  235. Dim oResource As ClusResource
  236. Set oResource = oCluster.QuorumResource
  237. lblQuorumResource = oResource.Name
  238. 'Display nodes
  239. ListTheNodes oCluster, ClusTree
  240. 'Display the resource types
  241. ListTheResourceTypes oCluster, ClusTree
  242. End Sub