mscomm最多支持16口,可是工程中至少需要48个口,已经用rs-485虚拟了,可是编程怎么办啊?哪位大虾帮帮忙啊?  是不是一定要用api啊,有没有好的空件啊,或编写好的成功的api的范例啊 ? 谢谢了
[email protected]

解决方案 »

  1.   

    The CreateFile function can create a handle to a communications resource, such as the serial port COM1. For communications resources, the dwCreationDisposition parameter must be OPEN_EXISTING, and the hTemplate parameter must be NULL. Read, write, or read/write access can be specified, and the handle can be opened for overlapped I/O. The COMM sample (TTY) demonstrates using the Win32 communications functions while maintaining a common code base with 16-bit Windows code.The program performs communications using the functions OpenFile, ReadFile, SetCommState, SetCommMask, WaitCommEvent, WriteFile, and CloseFile.The program creates a background thread to watch for COMM receiver events and posts a notification message to the main terminal window. Foreground character processing is written to the communications port.Simple TTY character translation is performed and a screen buffer is implemented for use as the I/O window.Overlapped file I/O techniques are demonstrated.http://msdn.microsoft.com/library/en-us/vcsample98/html/vcsmpserialsampleforcommunicationsdemonstration.asp
      

  2.   

    在com口前建立一个列表池,控制就可以了啊 :)
      

  3.   

    关注
    可以用writefile控制吧
    因为mscomm也不支持230400波特率的
      

  4.   

    “用rs-485虚拟了”是什么意思?
    可以只用一个串口,然后接一个rs485转换器,就可接128个设备了,只需要给每个设备定义不同的地址,通讯是加以区分就行了。
      

  5.   

    “用rs-485虚拟了” 是说实际只用计算机的一个串口去连接硬件,软件上就可以用com1 to com256 了啊.但是mscomm控件在连接各个串口时 在添入的串口号只支持到16 啊!