Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:07:40+00:00 2026-05-27T18:07:40+00:00

In a C# application, what are some good ways to detect the presence of

  • 0

In a C# application, what are some good ways to detect the presence of certain device connected to the computer? Programatically, of course. I need to support Windows XP and 7.

Background

I’ve been given a huge C# application that uses some connected device. The devices are custom hardware and are not designed to use without the software. When the C# app starts, it searches for such connected devices and communicates with them when appropriate. There can be more than one connected devices. I haven’t looked into the source code that searches the devices. The devices are plugged into the PC with either USB or serial cable. They appear as COM port in device manager. Sometimes there can be USB hub or serial to USB converters in between the PC and the device.

When the device is connected with certain USB hub, or certain serial to USB converter is used, sometimes the software cannot detect the device properly. Sometimes it varies from PC to PC. We’re not sure if it causes for some driver.

I’m told to look into the device searching algorithm and if possible, come up with better solution and replace current implementation. I haven’t done this sort of task before and I need to learn how Windows manage the devices under the hood.

How can I search for specific connected devices in C#? What are some good practice and what I should be aware of or avoid?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:07:40+00:00Added an answer on May 27, 2026 at 6:07 pm

    You can find all devices in registry: HKLM/CurrentControlSet/Enum ( http://msdn.microsoft.com/en-us/library/windows/hardware/ff546173(v=vs.85).aspx )

    But there will be problem with serial port. You can’t be certain in which device is connected to a serial port. It can be mobile phone, modem, mouse, your device, another custom device, etc. To guarantee that it is your device connected to a given serial port you must try to communicate with it. And if it responds in proper way – then yes, it is your device.

    Because of this many programs that works with serial devices asks user to manually select serial port, where device is connected.

    UPD:

    Another link about enumerating serial ports: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/afb62e84-53e5-4f17-ba91-8de15c4c2e38/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good evening, I am working on a program where some application config info is
Is there a good application (that has some kind of gui) for testing memory
I am creating some application, facebook application and i need to ask you something.
Obviously, horses for courses, but what are some good ways to integrate javascript libraries
Is it a good practice to bootstrap your PHP application. I found two ways
I know there are several ways to deploy a .net windows client application: There's
Some application we're using depends on TComponent descendants to easily save/load the state of
My application uses some webservice's and gets connectd to a server and sits on
I am developing some application in Linux .This Linux is a virtual machine running
In my application at some point, I have to call the Propel library version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.