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.

80 lines
1.8 KiB

  1. '
  2. L_Welcome_MsgBox_Message_Text = "This script demonstrates how to add/remove snapins from scriptable objects."
  3. L_Welcome_MsgBox_Title_Text = "Windows Scripting Host Sample"
  4. Call Welcome()
  5. ' ********************************************************************************
  6. Dim mmc
  7. Dim doc
  8. Dim snapins
  9. Dim frame
  10. Dim views
  11. Dim view
  12. Dim scopenamespace
  13. Dim rootnode
  14. Dim Nodes
  15. Dim scopenode
  16. Dim SnapNode1
  17. Dim Columns
  18. Dim Column
  19. 'get the various objects we'll need
  20. Set mmc = wscript.CreateObject("MMC20.Application")
  21. Set frame = mmc.Frame
  22. Set doc = mmc.Document
  23. Set namespace = doc.ScopeNamespace
  24. Set rootnode = namespace.GetRoot
  25. Set views = doc.views
  26. Set view = views(1)
  27. Set snapins = doc.snapins
  28. Set Sample = snapins.Add("{975797FC-4E2A-11D0-B702-00C04FD8DBF7}") ' Eventlog
  29. mmc.Show
  30. Set scopenamespace = doc.scopenamespace
  31. Set view = doc.ActiveView
  32. Set rootnode = namespace.GetRoot
  33. Set SnapNode1 = namespace.GetChild(rootnode)
  34. view.ActiveScopeNode = SnapNode1
  35. Set Columns = View.Columns
  36. ' All 1 based indices
  37. ' Get column 1
  38. Set Column = Columns.Item(1)
  39. ' Move it to column 2
  40. Column.DisplayPosition = 2
  41. intRet = MsgBox("Move Column", vbInformation, "Column 3 will be moved to 1")
  42. ' Get column 3
  43. Set Column = Columns.Item(3)
  44. ' Move it to column 1
  45. Column.DisplayPosition = 1
  46. mmc.UserControl = 1
  47. Set mmc = Nothing
  48. ' ********************************************************************************
  49. ' *
  50. ' * Welcome
  51. ' *
  52. Sub Welcome()
  53. Dim intDoIt
  54. intDoIt = MsgBox(L_Welcome_MsgBox_Message_Text, _
  55. vbOKCancel + vbInformation, _
  56. L_Welcome_MsgBox_Title_Text )
  57. If intDoIt = vbCancel Then
  58. WScript.Quit
  59. End If
  60. End Sub