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.

50 lines
1.2 KiB

  1. VERSION 5.00
  2. Begin VB.Form Form1
  3. Caption = "Form1"
  4. ClientHeight = 3195
  5. ClientLeft = 60
  6. ClientTop = 345
  7. ClientWidth = 4680
  8. LinkTopic = "Form1"
  9. ScaleHeight = 3195
  10. ScaleWidth = 4680
  11. StartUpPosition = 3 'Windows Default
  12. End
  13. Attribute VB_Name = "Form1"
  14. Attribute VB_GlobalNameSpace = False
  15. Attribute VB_Creatable = False
  16. Attribute VB_PredeclaredId = True
  17. Attribute VB_Exposed = False
  18. Private Sub Form_Load()
  19. Dim Context As SWbemNamedValueSet
  20. Set Context = New WbemScripting.SWbemNamedValueSet
  21. Context.Add "fred", -12.356
  22. Context.Add "joe", "blah"
  23. V1 = Context!fred
  24. V2 = Context("fred")
  25. Dim Service As SWbemServices
  26. Set Service = GetObject("winmgmts:{impersonationLevel=impersonate}")
  27. Dim E As SWbemObjectSet
  28. Set E = Service.InstancesOf("Win32_Service")
  29. Dim S As SWbemObject
  30. For Each S In E
  31. Debug.Print S.Name
  32. Next
  33. Set S = E("Win32_Service=""Winmgmt""")
  34. P = S.Path_.DisplayName
  35. Dim S1 As SWbemObject
  36. Set S1 = GetObject(P)
  37. Dim Property As SWbemProperty
  38. For Each Property In S1.Properties_
  39. Debug.Print Property.Name & " = " & Property.Value
  40. Next
  41. End Sub