Solved

A great challenge with the USB ports and devices

Posted on 2006-11-01
7
146 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

757 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

22 Experts available now in Live!

Get 1:1 Help Now