Click here to Skip to main content
12,446,418 members (56,068 online)
   

C#

 
GeneralRe: hello Pin
Keith Barrow4-Apr-13 4:36
mentorKeith Barrow4-Apr-13 4:36 
AnswerRe: hello Pin
Keith Barrow4-Apr-13 4:36
mentorKeith Barrow4-Apr-13 4:36 
GeneralRe: hello Pin
youshy4-Apr-13 4:57
memberyoushy4-Apr-13 4:57 
GeneralRe: hello Pin
Pete O'Hanlon4-Apr-13 5:09
protectorPete O'Hanlon4-Apr-13 5:09 
GeneralRe: hello Pin
youshy4-Apr-13 6:54
memberyoushy4-Apr-13 6:54 
GeneralRe: hello Pin
Keith Barrow4-Apr-13 5:15
mentorKeith Barrow4-Apr-13 5:15 
GeneralRe: hello Pin
youshy4-Apr-13 6:53
memberyoushy4-Apr-13 6:53 
QuestionUSB devices, WMI and C# Pin
MarkBrock4-Apr-13 0:22
memberMarkBrock4-Apr-13 0:22 
Hi all,

This is more of a WMI question than C#, but for lack of a more appropriate forum I am hoping someone here will know the answer.

I have a USB printer connected to my computer, and I am trying to retrieve the USB port ID for it in a C# application (i.e VID/PID).

I pulled the printer details from the WMI Win32_Printer class. The problem is the port field shows USB001 (which from what I understand is just a virtual allocation).

I discovered the actual USB port was a parent device called 'USB Printing Support', and the printer USB device was a child of that.

I pulled the WMI class Win32_USBControllerDevice and thought I found the relationship I need:
// The dependent here is the 'USB Printing Support' device I want to associate with the printer (and USB001)
Antecedent: \\MARK-PC-MKII\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_1E2D&SUBSYS_84CA1043&REV_04\\3&11583659&0&D0"
Dependent: \\MARK-PC-MKII\root\cimv2:Win32_PnPEntity.DeviceID="USB\\VID_04A9&PID_271A\\0000A1A6Q2NI"
 
// The dependent here is the printer 
Antecedent: \\MARK-PC-MKII\root\cimv2:Win32_USBController.DeviceID="PCI\\VEN_8086&DEV_1E2D&SUBSYS_84CA1043&REV_04\\3&11583659&0&D0"
Dependent: \\MARK-PC-MKII\root\cimv2:Win32_PnPEntity.DeviceID="USBPRINT\\CANONLBP6000/LBP6018\\7&2509A3F3&0&USB001"

Unfortunately the PCI bus that both devices are related with is also related with a bunch of other devices, so I am not sure this approach will work.

Does anybody know a way I could programically relate my printer device with its parent USB device (Preferably one which I could pull the USB device info once it has been related to the printer)

Note:
If I open the properties->details window for the 'USB Printing Support' device, there is a property called 'Children' which would be perfect... I just don't know how to get to it... ;-(.

Thank you.
Mark Brock
I'm pretty sure there's a lot more to life than being really, really, ridiculously good looking

AnswerRe: USB devices, WMI and C# Pin
Kenneth Haugland4-Apr-13 1:24
professionalKenneth Haugland4-Apr-13 1:24 
QuestionRock_Monu import a doc file in sql...??? Pin
rock_monu3-Apr-13 21:49
memberrock_monu3-Apr-13 21:49 
QuestionRe: Rock_Monu import a doc file in sql...??? Pin
Richard MacCutchan3-Apr-13 22:08
mvpRichard MacCutchan3-Apr-13 22:08 
QuestionNUnit test framework Pin
_Josh_3-Apr-13 16:34
member_Josh_3-Apr-13 16:34 
AnswerRe: NUnit test framework Pin
Pete O'Hanlon3-Apr-13 20:21
protectorPete O'Hanlon3-Apr-13 20:21 
GeneralRe: NUnit test framework Pin
_Josh_3-Apr-13 20:43
member_Josh_3-Apr-13 20:43 
AnswerRe: NUnit test framework Pin
Abhinav S3-Apr-13 20:30
mvpAbhinav S3-Apr-13 20:30 
AnswerRe: NUnit test framework Pin
Bernhard Hiller3-Apr-13 21:18
memberBernhard Hiller3-Apr-13 21:18 
AnswerRe: NUnit test framework Pin
BobJanova3-Apr-13 23:31
memberBobJanova3-Apr-13 23:31 
AnswerRe: NUnit test framework Pin
Keith Barrow4-Apr-13 1:55
mentorKeith Barrow4-Apr-13 1:55 
AnswerRe: NUnit test framework Pin
jschell4-Apr-13 9:15
memberjschell4-Apr-13 9:15 
Questionuse a class methode that implements and interface from another class Pin
tux@ddictor3-Apr-13 7:49
membertux@ddictor3-Apr-13 7:49 
AnswerRe: use a class methode that implements and interface from another class Pin
tux@ddictor3-Apr-13 7:53
membertux@ddictor3-Apr-13 7:53 
AnswerRe: use a class methode that implements and interface from another class Pin
Collin Jasnoch3-Apr-13 9:31
memberCollin Jasnoch3-Apr-13 9:31 
QuestionC# Pin
sanjugen3-Apr-13 0:07
membersanjugen3-Apr-13 0:07 
AnswerRe: C# Pin
cursore843-Apr-13 0:31
membercursore843-Apr-13 0:31 
AnswerRe: C# Pin
Simon_Whale3-Apr-13 0:58
memberSimon_Whale3-Apr-13 0:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.160811.3 | Last Updated 24 Aug 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid