CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2008
    Posts
    8

    Serial Com: COM1 being occupied.

    Hi all,

    I am facing a problem when trying to open a com port (COM1), it says, it is already in use.
    I tried to check the Mice and other pointing devices through device manager. I found that either a PS / 2 or a Serial Microsoft Ball point is enabled.
    If I disable PS / 2 and Serial Microsoft Ball point, I dont get that problem.

    I would like to know what is occupying COM1 and how to disable it through C / C++ Code.

    Please help.

    Thanks in advance,
    Doll.

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Serial Com: COM1 being occupied.

    I would like to know what is occupying COM1 and how to disable it through C / C++ Code.
    As far as I know, you can't. COM is a simple port, it has no management system like USB ports.

  3. #3
    Join Date
    Mar 2004
    Location
    Central Florida
    Posts
    293

    Re: Serial Com: COM1 being occupied.

    Skizmo is correct, if COM1 is in use try COM2, COM3, etc. (assuming you have moe than 2 COM ports.).
    "Effective teaching is the essence of leadership..."

    "There is no substitute for a carefully thought-out design."

    If you have found this post to be useful, please Rate it.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Serial Com: COM1 being occupied.

    What do you want to achieve? Why do you want to disable it? Just use another one that is available. You can see that in the Device Manager.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Nov 2008
    Posts
    8

    Re: Serial Com: COM1 being occupied.

    I have a situation where i have to use only COM1 for my communication, COM2, COM3, COM4 are being used for other communications. I need to do some thing which would disable the process or applications etc that are using the required COM ports, to let my project run. I want some C or C++ code to do this work, as i dont want to do it manually.

    Please help.
    Thanks
    DOLL.

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Serial Com: COM1 being occupied.

    It is a very serious design flaw to rely on some predefined com port numbers!
    What will happen if some PC does not have COM2, COM3, COM4 at all?
    If the only port COM1 was already assigned to IR communications and there is not any serial port connector? What will happen when only USB-to-serial adapters are available and port numbers are assigned automatically by device manager?
    What to do if a connector for COM1 (or 2, or 3, ...) is broken?
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured