[原创]VB6.0串口控件mscomm32.ocx 破解版,支持大于16的串口号

2020-01-07 19:26发布

本帖最后由 gtrajtr 于 2015-1-26 18:46 编辑

在坛子里看到有坛友抱怨VB6的串口控件mscomm32.ocx 不支持大于16的端口号,有时候使用不方便。
自己就顺手把它破了这个限制,端口号最高支持到255,一般情况应该足够用了。

另外,有坛友说mscomm32在64位系统下用不了,我没有遇到过这种情况。
mscomm32肯定是支持64位系统的,有些老项目的上位机软件是VB写的,一直在64位系统都用得好好的。

用VB写了个简单的测试程序,在win7 64bit下测试通过,串口是用CH340从USB转出来的串口,TX、RX断接,点TX,能正常收发数据。

截图,微软原版本的mscomm32.ocx,打开串口17出错
破解版mscomm32控件-254.png (34.9 KB, 下载次数: 0) 下载附件 2015-1-26 18:34 上传
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
68条回答
mon51
2020-01-15 11:21
本帖最后由 mon51 于 2017-6-17 13:04 编辑
gmyu 发表于 2017-6-17 12:45
你有调用api的VB程序么?好久没搞,发现以前国外的一个程序在office2010 win7 64下面不能用了。 前段时间 ...


'****************************************************************************************************************************************
Public Declare Function OpenComm Lib "User" (ByVal IpComName As String, ByVal wInQueue As Integer, ByVal wOutQueue As Integer) As Integer

Public Declare Function SetCommState Lib "User" (IpDCB As DCB) As Integer

Public Declare Function ReadComm Lib "User" (ByVal nCid As Integer, ByVal IpBuf As String, ByVal nSize As Integer) As Integer

Public Declare Function WriteComm Lib "User" (ByVal nCid As Integer, ByVal IpBuf As String, ByVal nSize As Integer) As Integer

Public Declare Function Closecomm Lib "User" (ByVal nCid As Integer) As Integer

Public Declare Function BuildCommDCB Lib "User" (ByVal IpDef As String, IpDCB As DCB) As Integer

Public Declare Function GetCommError Lib "User" (ByVal nCid As Integer, IpStat As COMSTAT) As Integer
'****************************************************************************************************************************************

Type DCB

    Id As String
   
    BaudRate As Integer
   
    ByteSize As String
   
    Parity As String
   
    StopBits As String
   
    RlsTimeout As Integer
   
    CtsTimeout As Integer
   
    DsrTimeout As Integer
   
    Bits1 As String
   
    Bits2 As String
   
    XonChar As String
   
    XoffChar As String
   
    XonLim As Integer
   
    XoffLim As Integer
   
    PeChar As String
   
    EofChar As String
   
    EvtChar As String
   
    TxDelay As Integer

End Type

Type COMSTAT

    Bits As String
   
    cbInQue As Integer
   
    cbOutQue As Integer

End Type

'*************************************************************************************

Public IpDCB As DCB

Public nCid As Integer


VB用得少,这个是从来软件中COPY出来得头文件。可以用。

一周热门 更多>