Solved

A great challenge with the USB ports and devices

Posted on 2006-11-01
7
149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

696 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