Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Knowing the serial port Plug/Unplug status

Knowing the serial port Plug/Unplug status

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VCSharp007
    wrote on last edited by
    #1

    Hi , I am facing a problem. In my MFC application I have to check whether serial port is in Plugged/Unplugged status. Any method for finding it? any window message or event for knowing serial port status? Thanx in advance

    K 1 Reply Last reply
    0
    • V VCSharp007

      Hi , I am facing a problem. In my MFC application I have to check whether serial port is in Plugged/Unplugged status. Any method for finding it? any window message or event for knowing serial port status? Thanx in advance

      K Offline
      K Offline
      kakan
      wrote on last edited by
      #2

      Hello. There are status signals you can test, such as DSR (Data Set Ready) and CTS (Clear To Send) (Provided you did set RTS (Request To Send) high first). If there are a device connectoed to the port, those staus signals should indicate the port is connected to a powered on device. But in my experience, the status signals aren't 100% trustworthy when the serial port is unplugged. What's worse, it seems as their state depends on the hardware. So the best way to find out, is to send some kind of status question to the device, then wait for an answer. If you get an answer, it's definately plugged in.

      Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups