使用VBScript获取连接的操纵杆列表

时间:2012-07-26 07:54:17

标签: vbscript joystick

我正在寻找一种可以通过VBScript获取连接操纵杆列表的方法,如下图所示(我的意思是它们的顺序非常重要):

joy.cpl is list the connected joysticks

1 个答案:

答案 0 :(得分:1)

以下是执行此操作的代码...很难在网上找到...

strComputer = "." Set objWMIService = GetObject("winmgmts:" _ &
"{impersonationLevel=impersonate}!\\" & strComputer & "oot\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from
Win32_PnPEntity")

For Each objItem in colItems

Wscript.Echo "Class GUID: " & objItem.ClassGuid
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Device ID: " & objItem.DeviceID
Wscript.Echo "Manufacturer: " & objItem.Manufacturer
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "PNP Device ID: " & objItem.PNPDeviceID
Wscript.Echo "Service: " & objItem.Service

Next

希望this帮助