Testing to see if device is enabled/disabled using VB

Talismanic

Registered User.
Local time
Today, 00:04
Joined
May 25, 2000
Messages
377
This is more a Visual Basic question then it is a VBA question but I am hoping some one here can help.

I have a device on a Windows 2000 machine that I need to be able to enable or disable on the fly. I was shown a solution using Send Keys like this:

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Mice"
WshShell.SendKeys "{Right}"
WshShell.SendKeys "{Down}"
WshShell.SendKeys "+{F10}"
WshShell.SendKeys "D"
WshShell.SendKeys "%Y"
WshShell.SendKeys "%{F4}"

It works great but I would like to test whether the device is enabled or disabled before I run the script, anybody know how to do that?
 

Users who are viewing this thread

Back
Top Bottom