Samuelhug Posted December 12, 2006 Posted December 12, 2006 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++CODEOption Strict OffOption Explicit OnImports System.TextImports System.ThreadingModule 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 ShortEnd ModulePublic 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 SubEnd ClassThis is the code from my attempt to convert it.CODEConsoleWrite( _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]EndFuncFunc _Inp( $PortAddress) $Value = DllCall( "inpout32.dll", "Short", "Inp32", "Short", $PortAddress) ;ConsoleWrite( "Error# " & @error & @CR) Return $Value[0]EndFunc
PaulIA Posted December 12, 2006 Posted December 12, 2006 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Ê&zØb bæ®¶sd6öç6öÆUw&FRô÷WB3sÂfײ5"¥6ÆVW¤6öç6öÆUw&FRô÷WB3sÂfײ5"oÝ÷ Ù8Z¶+"*.ßÚÞ¶¼¢h¸yZÛ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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now