Jump to content

inpout32.dll


 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...