Jump to content

Recommended Posts

Im trying to make a program to Read/Write data to and from the parallel port with DllCall inpout32.dll.This is the code in VB 2005 if someone could convert it for me that would be great.

inpout32.dll Link includes examples for VB, VC, and C++

CODE

Option Strict Off

Option Explicit On

Imports System.Text

Imports System.Threading

Module InpOut32_Declarations

'Inp and Out declarations ofr port I/O using inpout32.dll

Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As Short) As Short

Public Declare Function Out Lib "inpout32.dll" Alias "Out32" (ByVal PortAdress As Short, ByVal Value As Short) As Short

End Module

Public Class Form1

Private Sub CWBut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CWBut.Click

Out(&H378S, &H1S)

Thread.Sleep("100")

Out(&H378S, &H0S)

End Sub

End Class

This is the code from my attempt to convert it.

CODE

ConsoleWrite( _Out( "&H378S", "H1S") & @CR)

Sleep( 100 )

ConsoleWrite( _Out( "&H378S", "H0S") & @CR)

Func _Out( $PortAddress, $Value)

$Retur = DllCall( "inpout32.dll", "Short", "Out32", "str", $PortAddress, "str", $Value )

ConsoleWrite( "Error# " & @error & @CR)

Return $Retur[0]

EndFunc

Func _Inp( $PortAddress)

$Value = DllCall( "inpout32.dll", "Short", "Inp32", "Short", $PortAddress)

;ConsoleWrite( "Error# " & @error & @CR)

Return $Value[0]

EndFunc

Link to post
Share on other sites

The problem that I see in your code is:

ConsoleWrite( _Out( "&H378S", "H1S") & @CR)
Sleep( 100 )
ConsoleWrite( _Out( "&H378S", "H0S") & @CR)oÝ÷ Ù(hºW[&zØb   b殶­sd6öç6öÆUw&FRô÷WB3sÂfײ5"¥6ÆVW¤6öç6öÆUw&FRô÷WB3sÂfײ5"oÝ÷ Ù8Z¶+"*.ßÚÞ¶¼¢h¸­y­ZÛazv´¶h®Ý1ß¿z··öȬ­#
èµëajÛzk-£
+«­¢+Ù
½¹Í½±]ɥѡ}=ÕÐÌÈ ÁàÌÜà°Ä¤µÀì
H¤)
½¹Í½±]ɥѡ}=ÕÐÌÈ ÁàÌÜà°À¤µÀì
H¤()Õ¹}%¹ÀÌÈ ÀÌØí¥ÉÍ̤(1½°ÀÌØíIÍÕ±Ð((ÀÌØíIÍÕ±Ðô±±
±° ÅÕ½Ðí%¹Á=ÕÐÌȹ±°ÅÕ½Ðì°ÅÕ½ÐíÍ¡½ÉÐÅÕ½Ðì°ÅÕ½Ðí%¹ÀÌÈÅÕ½Ðì°ÅÕ½ÐíÍ¡½ÉÐÅÕ½Ðì°ÀÌØí¥ÉÍ̤(IÑÕɸÀÌØíIÍÕ±ÑlÁt)¹Õ¹()Õ¹}=ÕÐÌÈ ÀÌØí¥ÉÍÌ°ÀÌØí¥Ñ¤(1½°ÀÌØíIÍÕ±Ð((ÀÌØíIÍÕ±Ðô±±
±° ÅÕ½Ðí%¹Á=ÕÐÌȹ±°ÅÕ½Ðì°ÅÕ½ÐíÍ¡½ÉÐÅÕ½Ðì°ÅÕ½Ðí=ÕÐÌÈÅÕ½Ðì°ÅÕ½ÐíÍ¡½ÉÐÅÕ½Ðì°ÀÌØí¥ÉÍÌ°ÅÕ½ÐíÍ¡½ÉÐÅÕ½Ðì°ÀÌØí¥Ñ¤(IÑÕɸÀÌØíIÍÕ±ÑlÁt)¹Õ¹
Auto3Lib: A library of over 1200 functions for AutoIt
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...