CWmiServicesconstructor
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.
Syntax
CONSTRUCTOR CWmiServices (BYREF wszDisplayName AS WSTRING)
Also documented as
Constructor (Moniker) — one description covers them all.Parameters
| Name | Description | |
|---|---|---|
wszDisplayName | The display name for the object to be created. |
Description
Connects to WMI using a moniker.
Examples
' // Connect to WMI using a moniker ' // Note: $ is used to avoid the pedantic warning of the compiler about escape characters DIM pServices AS CWmiServices = $"winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2"
' // Connect with WMI in the local computer and get the properties of the specified printer DIM pDisp AS CDispInvoke = CWmiServices( _ $"winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2:" & _ "Win32_Printer.DeviceID='OKI B410'").ServicesObj
' // Set the printer as the default printer DIM dvRes AS DVARIANT = pDisp.Invoke("SetDefaultPrinter") print "Result: ", VAL(dvRes)
This example uses CWmiServices and CDispInvoke to easily set the specified printer as the default printer:
Reference
- Include file
CWmiDisp.inc - Documented in COM/CWmiDisp Class.md
- Topic: Windows Management Instrumentation (WMI)