使用VB输出LPT端口 [英] Output of the LPT port using VB
问题描述
我正在使用本文使用Inpout32.dll从并行端口读取来控制并行端口的过程。这是代码,
Hi,
I am following the procedure of the controlling the Parallel port using this article "Reading from Parallel Port using Inpout32.dll". And this is the code,
Option Strict Off
Option Explicit On
Module InpOut32_Declarations
'Inp and Out declarations for port I/O using inpout32.dll.
Public Declare Function Inp Lib "inpoutx64.dll" Alias "Inp32" (ByVal PortAddress As Short) As Short
Public Declare Sub Out Lib "inpoutx64.dll" Alias "Out32" (ByVal PortAddress As Short, ByVal Value As Short)
End Module
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Out(&H378S, &HFFS) 'Print '1' to D7-D0 or 255 in Decimal
Dim Value1 As String 'String named Value1
Value1 = Inp(&H378S) 'Now Value1 has the values in 'data port'
MessageBox.Show(Value1) 'A popup will indicate the current value written
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Value2 As String 'String named Value2
Value2 = Inp(&H379S) 'Now Value2 has the values in 'signal port'
MessageBox.Show(Value2) 'A popup will indicate the current value written
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
操作系统是Windows 7 64位,我使用的是Inpoutx64.dll。代码在一台电脑上工作正常,但它不适用于另一台同一操作系统的电脑。当我点击按钮1这是数据总线的输出时,结果总是120,无论我给数据总线的值是什么!
任何建议如何解决这个问题呢? Plz。
关注
The operating system is Windows 7 64bit and I used Inpoutx64.dll. The code works fine in one pc but it doesn't work on another pc which is the same operating system. When I click Button one "which is the out put for the Data Bus" the results always 120, whatever the value that I give for the Data bus!
Any suggestion how to solve this problem? Plz.
Regards
推荐答案
检查LPT端口配置(在BIOS)在两台PC上。其他可能性是硬件问题:我的PC没有任何并行端口在板上。
Check LPT ports configuration (in BIOS) on both PC. Other possibility is a hardware problem: I've PC without any parallel port "on board".
你好!
亲切确保下面,
1)符合你的'inpoutx64.dll'版本1.2.0.0,然后这个版本的.dll可以支持Win -7 OS。
2)第一次在'以管理员身份运行'模式下打开你的应用程序(.exe)。
我希望,以上可以解决您的数据 - > 120 结果问题。
- Ram V -
Hello !
Kindly ensure below,
1) Conform your 'inpoutx64.dll' version 1.2.0.0, then this version of .dll can support for Win-7 OS.
2) And first time you should open your application(.exe) in 'Run as Administrator' mode.
I Hope, The above can solve your data -> 120 results issues.
- Ram V -
这篇关于使用VB输出LPT端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!