Baz Posted March 7, 2006 Posted March 7, 2006 Hi ya. Could someone provide a line of code that uses this dll to turn on one of the LPT data pins? At the moment I am using another program to control the LPT port but would like to do it with AutoIt. Thanks in advanced. Baz.
Baz Posted March 8, 2006 Author Posted March 8, 2006 where is that dll located? The dll can be found at http://www.logix4u.net This is my code at the moment. The function for button 3 was found from another post in the forum. Cheers Baz #include <GUIConstants.au3> Opt ("GUIOnEventMode", 1) GUICreate("Animate Window", 300, 300) $Button1 = GUICtrlCreateButton("On", 24, 40, 121, 33, 0) GUICtrlSetOnEvent (-1, "button1") $Button1 = GUICtrlCreateButton("Off", 24, 80, 121, 33, 0) GUICtrlSetOnEvent (-1, "button2") $Button2 = GUICtrlCreateButton("Check", 24, 120, 121, 33, 0) GUICtrlSetOnEvent (-1, "button3") $Button3 = GUICtrlCreateButton("Exit", 24, 160, 121, 33, 0) GUICtrlSetOnEvent (-1, "button4") GUISetState(@SW_SHOW) $BasePortAddr = 0x379 While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Func button1() $d = DllCall("inpout32.dll", "short", "Out32", "short", $BasePortAddr, "short", "5") MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($d)) EndFunc Func button2() $d = DllCall("inpout32.dll", "short", "Out32", "short", $BasePortAddr, "short", "0") MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($d)) EndFunc Func button3() $r = DllCall("inpout32.dll", "short", "Inp32", "short", $BasePortAddr) MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($r[0])) EndFunc Func button4() Exit EndFunc
cppman Posted March 8, 2006 Posted March 8, 2006 their is'nt really an extensive list of functions that the DLL contains... Miva OS Project
cppman Posted March 8, 2006 Posted March 8, 2006 (edited) yeah... on the website, it only gives a few function names, no parameters or anything... Edited March 8, 2006 by CHRIS95219 Miva OS Project
Baz Posted March 8, 2006 Author Posted March 8, 2006 yeah... I have no idea of any functions that are in this DLL... Ok, only spent about 4 hours on this now (only been using AutoIT since start of the year and I haven't tried to do things like this before!) Anyway I have got it going after reading from the following site. And here is my script as the basic function is working. I will now add the following: -Tick box and or button for each of the eight outputs -Graphic to represent the LED and or Relay -Ability to add script to cycle the outputs. Hope this may be of help to others. Cheers Baz. #include <GUIConstants.au3> Opt ("GUIOnEventMode", 1) GUICreate("BazMan LED Switch", 300, 300) $Button1 = GUICtrlCreateButton("On", 24, 40, 121, 33, 0) GUICtrlSetOnEvent (-1, "button1") $Button1 = GUICtrlCreateButton("Off", 24, 80, 121, 33, 0) GUICtrlSetOnEvent (-1, "button2") $Button2 = GUICtrlCreateButton("Check", 24, 120, 121, 33, 0) GUICtrlSetOnEvent (-1, "button3") $Button3 = GUICtrlCreateButton("Exit", 24, 160, 121, 33, 0) GUICtrlSetOnEvent (-1, "button4") GUISetState(@SW_SHOW) $lpt1 = 888 ; hex. is 378 so dec. is 888 $lpt2 = 632 ; hex. is 278 so dec. is 632 $BasePortAddr = $lpt1 While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Func button1() $d = DllCall("inpout32.dll", "short", "Out32", "short", $BasePortAddr, "int", "11111111") ;MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($d)) ; used to check error returned from using dll if any! EndFunc Func button2() $d = DllCall("inpout32.dll", "short", "Out32", "short", $BasePortAddr, "short", "00000000") ;MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($d)) EndFunc Func button3() $r = DllCall("inpout32.dll", "short", "Inp32", "short", $BasePortAddr) MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($r[0])) EndFunc Func button4() Exit EndFunc
peter1234 Posted March 8, 2006 Posted March 8, 2006 Baz,Thanks. Sometime I may want to send data in and out the LPT port and this will come in handy. What was the site you found the information on? Was it http://www.logix4u.net ?
Baz Posted March 8, 2006 Author Posted March 8, 2006 Baz,Thanks. Sometime I may want to send data in and out the LPT port and this will come in handy. What was the site you found the information on? Was it http://www.logix4u.net ?Sorry, I see that I forgot to add the url.http://www.codeproject.com/csharp/csppleds.asp and about two thirds the way down the page was where I found the answer.Baz
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