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. MSComm Control exits with error?

MSComm Control exits with error?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++debugginghelp
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have a question regarding a MSComm Control on a simple dialog form with a thread that exits with an error code 0x1. A new project created with VC++ 6.0 App Wiz, simple dialog, with a MSComm control and a variable mapped to m_Commm and one command button, OpenClose. In 'OnOpenClose' place: m_Comm.SetCommPort(1); m_Comm.SetPortOpen(true); // Doesn't seem to matter whether I // put additional code in here or not. m_Comm.SetPortOpen(false); While using an external analyzer, I can see that the port in question is opening and closing, in fact with additional code I can send and receive data through this port, but always when I close the port the debug window shows a message that the thread has closed with error code 0x1. As near as I can tell this corresponds to ERROR_INVALID_FUNCTION. So my question is; Do I actually have an invalid function, or am I misreading the thread error message?:confused:

    L 1 Reply Last reply
    0
    • L Lost User

      I have a question regarding a MSComm Control on a simple dialog form with a thread that exits with an error code 0x1. A new project created with VC++ 6.0 App Wiz, simple dialog, with a MSComm control and a variable mapped to m_Commm and one command button, OpenClose. In 'OnOpenClose' place: m_Comm.SetCommPort(1); m_Comm.SetPortOpen(true); // Doesn't seem to matter whether I // put additional code in here or not. m_Comm.SetPortOpen(false); While using an external analyzer, I can see that the port in question is opening and closing, in fact with additional code I can send and receive data through this port, but always when I close the port the debug window shows a message that the thread has closed with error code 0x1. As near as I can tell this corresponds to ERROR_INVALID_FUNCTION. So my question is; Do I actually have an invalid function, or am I misreading the thread error message?:confused:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I have been using MSComm for a while now, and I don't use the .SetPortOpen(FALSE), just let the destructor close it when the application exits. This works fine when I exit the app then sue Hyperterminal etc.. Elaine :rose: The tigress is here :-D

      J 1 Reply Last reply
      0
      • L Lost User

        I have been using MSComm for a while now, and I don't use the .SetPortOpen(FALSE), just let the destructor close it when the application exits. This works fine when I exit the app then sue Hyperterminal etc.. Elaine :rose: The tigress is here :-D

        J Offline
        J Offline
        jia_wei
        wrote on last edited by
        #3

        i recomment not to use mscomm32.ocx,it sometimes does not work well in windows 2k and windows xp,you can use class CSerialPort that can be download from internet

        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