Solved

A great challenge with the USB ports and devices

Posted on 2006-11-01
7
147 Views
Last Modified: 2010-04-30

I`m need to create an aplication in visual basic 6.0, that could monitor USB devices a projector a smart board, APC,Printer all on the USB Port, the big problem is to detect via USB the name and manufacter of the device. Also I need to establish a comunication with these hardware like asking the projector how many hours has been on line and the life status of the lamp bolt.

In the printer I have to ask similar questions like how much ink is left on the cartridge or time left to be with out ink.

I really try several windows dll like msinfo32 or kernel32 but the only think a receive is a serial number of the device nothing more.

This is really urgent for my enterprise

This will meant a lot for me and my boss
0
Comment
Question by:pedro_arzac
  • 2
  • 2
7 Comments
 
LVL 76

Assisted Solution

by:GrahamSkan
GrahamSkan earned 100 total points
ID: 17853381
I think that you are looking for some kind of magic.

For some classes of device, such as printers, their drivers can give a standard set of answers, such as selected tray. However, these definitions differ considerably, so you need a knowledge of each driver, and how to communicate with it.

You can tell this from the utilities that the device manufactureres provide.
 
For other devices, there is nothing approaching ther interface that you are expecting.  For instance, as far as I know, most projecter devices do not provide the digital data, or a means to interrogate the lamp life.

0
 
LVL 15

Accepted Solution

by:
JackOfPH earned 400 total points
ID: 17854500
0
 
LVL 15

Assisted Solution

by:JackOfPH
JackOfPH earned 400 total points
ID: 17854506
Dim obj, objs, buf

Set objs = GetObject("winmgmts:").InstancesOf("Win32_DiskDrive")
For Each obj In objs
     If obj.InterfaceType = "USB" Then
          buf = "Model: " & obj.Model & vbCr
          buf = buf & "PnP Device ID: " & obj.Manufacturer
          MsgBox (buf)
     End If
Next
0
 

Author Comment

by:pedro_arzac
ID: 17867430

Hi JackOFPH I have use your code but it doesn`t work for me Because it only detects the logical Disks, but the devices like a printer, or projector or any other device detect and adopted by the Windows OS is not seen like a logial drive.

I will accept any other suggestion?
0
 

Author Comment

by:pedro_arzac
ID: 17867759

Hi GrahamSkan you`re right I really need some magic code.

My real problem is that I`t was supposed that my client will give me tha API for the devices to monitoring them, but In the last moment they order me to create the API so, I need to stablish the communication with the USB devices, I have the utility programs that came with the devices but I don`t know how to extract information from them.

The main problem is that first I need to identify the devices connected to the machine, the devices not the logical disks this is rough and then communicate with them .

I accept Any suggestions
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now