From: USB Device User USB Device on
I have a USB printer and I know its vendor ID and product ID. How can I know
it is connected from my C# application?
From: USB Device User on
BTW, I am trying to use winapi calls not wmi.

"USB Device User" wrote:

> I have a USB printer and I know its vendor ID and product ID. How can I know
> it is connected from my C# application?
From: Philip Ries [MSFT] on
One way is via Setup API (it's a managed API so you will have to PInvoke
it). Start with function SetupDiGetClassDevs.

USB Device User wrote:
> BTW, I am trying to use winapi calls not wmi.
>
> "USB Device User" wrote:
>
>> I have a USB printer and I know its vendor ID and product ID. How can I know
>> it is connected from my C# application?
From: USB Device User on
I tried SetupDi functions. It is easy for HID to get GUID and VID/PID. But
for general USB device, how can I get GUID and VID/PID from the api calls?

"Philip Ries [MSFT]" wrote:

> One way is via Setup API (it's a managed API so you will have to PInvoke
> it). Start with function SetupDiGetClassDevs.
>
> USB Device User wrote:
> > BTW, I am trying to use winapi calls not wmi.
> >
> > "USB Device User" wrote:
> >
> >> I have a USB printer and I know its vendor ID and product ID. How can I know
> >> it is connected from my C# application?
> .
>
From: Pavel A. on
"USB Device User" <USBDeviceUser(a)discussions.microsoft.com> wrote in message
news:60FB1C84-C1E3-42EA-9848-9B67D9F0D96F(a)microsoft.com...
> I tried SetupDi functions. It is easy for HID to get GUID and VID/PID. But
> for general USB device, how can I get GUID and VID/PID from the api calls?

Have you tried SetupDiGetClassDevs ?
-- pa

> "Philip Ries [MSFT]" wrote:
>
>> One way is via Setup API (it's a managed API so you will have to PInvoke
>> it). Start with function SetupDiGetClassDevs.
>>
>> USB Device User wrote:
>> > BTW, I am trying to use winapi calls not wmi.
>> >
>> > "USB Device User" wrote:
>> >
>> >> I have a USB printer and I know its vendor ID and product ID. How can
>> >> I know
>> >> it is connected from my C# application?
>> .
>>