how to detect the hardware(Serial Port) using visual studio?

This is a discussion on how to detect the hardware(Serial Port) using visual studio? within the Networking/Device Communication forums, part of the General Programming Boards category; May I know, from which API we can find out exactly our hardware is connected on which port? I know ...

  1. #1
    Registered User
    Join Date
    Apr 2011
    Location
    dust
    Posts
    66

    how to detect the hardware(Serial Port) using visual studio?

    May I know, from which API we can find out exactly our hardware is connected on which port?
    I know about my H/W vendor ID, so with the help of that I want to know exactly on which port my device is connected?

    Note: I got failed on SetupDiGetDeviceInterfaceDetail() API. That gave all the H/W details except my device which is connected to my PC

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    Devices that connect to a serial port typically aren't "plug-and-play" devices - meaning the OS doesn't know what you have connected to the serial port.

    Does the device you're looking for have an entry in device manager?

    gg

  3. #3
    Registered User
    Join Date
    Apr 2011
    Location
    dust
    Posts
    66
    Quote Originally Posted by Codeplug View Post
    Devices that connect to a serial port typically aren't "plug-and-play" devices - meaning the OS doesn't know what you have connected to the serial port.

    Does the device you're looking for have an entry in device manager?

    gg
    For the first time, user will provide the driver software for their H/W to OS.
    But there after, if user connected the device to PC after sometime, our program has to detect, exactly on which port the device has connected?

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    What device is it?
    How does it connect to the PC? USB? DB9 serial connection?
    Does the device have an entry in device manager when it is connected?

    gg

  5. #5
    Registered User
    Join Date
    Apr 2011
    Location
    dust
    Posts
    66
    Quote Originally Posted by Codeplug View Post
    What device is it?
    How does it connect to the PC? USB? DB9 serial connection?
    Does the device have an entry in device manager when it is connected?

    gg
    Its an USB device. I have the driver software for that particular device and installed in the PC.
    Whenever i connected to PC, its having a entry point in Device Manager.
    (By manually, I can go and check under MyComputer->Manage->DeviceManager->Ports)
    But I want to write a program to detect the Port number automatically whenever its connected to PC.
    Any API's recommented?


    Note: I know Product Id and Vendor Id of that particular Device.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    CodeGuru Forums - View Single Post - Obtaining serial number of the soundcard

    You will need to pass false to the last parameter of ListDeviceClassData(), and use the device-interface-class-guid for your device: System-Defined Device Interface Classes (Windows Drivers)

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 21
    Last Post: 06-24-2009, 09:49 AM
  2. Replies: 34
    Last Post: 02-26-2006, 12:16 PM
  3. Serial port woes (visual C++ .NET 2003)
    By RancidWannaRiot in forum Windows Programming
    Replies: 1
    Last Post: 11-21-2005, 07:59 AM
  4. Port C++ .NET Project back C++ 6.0 :: Visual Studio
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 11-17-2002, 12:11 PM
  5. Replies: 2
    Last Post: 11-14-2001, 08:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21