vb.net ms comm 出现异常

发布于 2024-12-18 00:21:25 字数 530 浏览 4 评论 0 原文

我在应用程序中使用 microsoft com control 6.0 将数据发送到 LED 控件,

         MSComm1.EOFEnable = True
        MSComm1.SThreshold = 100
        MSComm1.InputLen = 0
        MSComm1.RThreshold = 1
        MSComm1.InBufferCount = 0
        MSComm1.OutBufferCount = 0
        MSComm1.NullDiscard = False
        MSComm1.CommPort =1
        MSComm1.PortOpen = True <-Getting exception to this line
        ......

但我收到来自 HRESULT: 0x800A1F45 的异常。为什么此端口未打开。 当我通过 vb6 运行它时,我没有收到错误...任何人都可以帮助我...

I used microsoft com control 6.0 in the application for sending data to the led control

         MSComm1.EOFEnable = True
        MSComm1.SThreshold = 100
        MSComm1.InputLen = 0
        MSComm1.RThreshold = 1
        MSComm1.InBufferCount = 0
        MSComm1.OutBufferCount = 0
        MSComm1.NullDiscard = False
        MSComm1.CommPort =1
        MSComm1.PortOpen = True <-Getting exception to this line
        ......

I am geting Exception from HRESULT: 0x800A1F45 .Why does this port is not opening .
When i run it through vb6 i doesnt get error ...Anybody can help me...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

‖放下 2024-12-25 00:21:25

错误 800A1F45 通常表示该端口正在被其他应用程序使用。

您可以根据这篇维基百科文章解码 HRESULT。对于 0x800A1F45,您会发现:

  • 第三位是 0,因此这是 Microsoft 错误
  • 设施位是十六进制 0xA,或十进制 10,根据 MSDN 列表 表示“控制”
  • 错误代码位为十六进制 0x01F45,或十进制 8005。根据 MSComm 控件的错误列表,表示“端口已打开”

Error 800A1F45 usually means the port is in use by another application.

You can decode an HRESULT according to this Wikipedia article. For 0x800A1F45, you'll find:

  • The third bit is 0, so it's a Microsoft error
  • The facility bits are hex 0xA, or decimal 10, which according to the MSDN list means "Control"
  • The error code bits are hex 0x01F45, or decimal 8005. According to the error list for the MSComm control that means "Port already open"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文