Jump to content

Help troubleshoot my code for "inpout32.dll", please.


lte5000
 Share

Recommended Posts

Edit: The attached copy of the DLL was corrupt, I believe. I have now attached an intact copy.

"Inpout32.dll" information:

A versatile Dynamic Link Library for parallel port interfacing. Can be used on both WIN9X and WIN NT/2000/XP machines.

Home page.

Here's the code I have:

DllCall("inpout32.dll", "none", "Out32", "int", 0x378, "int", 0)
;First param is parallel port address. 
;Second param is value to write to the port.

However, that code produces an AutoIt3 crash.

Tested with beta and stable.

Could someone help me out by testing (or experience) , or am I making a dumb mistake?

I have attached a copy of "inpout32.dll".

Or, you can download "inpout32.dll" and sources, here.

Also, below is some C# code for the same DLL:

using System;
using System.Runtime.InteropServices;

public class PortAccess
{
    [DllImport("inpout32.dll", EntryPoint="Out32")]
    public static extern void Output(int adress, int value);
}

Thanks,

If any more information needed, just ask,

Kendall

Edit1: Tidy.

Edit2: Tidy and add info.

Edit3: Tidy and add info.

Edit4: Correction.

inpout32.dll

Edited by lte5000
Link to comment
Share on other sites

The code works (doesn't crash)... but likewise, my code, now!

My code was working (not crashing) yesterday, too, at least under some circumstances.

Weird.

I also found "io.dll" on another site, which seems to function correctly.

BTW, RAMzor, could you give me an example of how to get the state of an input pin on the parallel port, using "inpout32.dll" or some other XP compatible DLL? I want to connect a simple input switch to the parallel port.

I don't really understand how to read the state of the pins. I might research it more sometime.

Kendall

Edit: Thanks for the support, everyone.

Edited by lte5000
Link to comment
Share on other sites

Ok, I guess I had a corrupt version of inpout32.dll.

I'm not getting the crashes with the correct copy. The copy I had earlier was 27k in size, vs. the correct size of 32k.

Thanks for the support.

I do have one more question.

Why can't I get any return from the "Inp32" function of inpout32.dll?

Here's my code:

$r = DllCall("inpout32.dll", "short", "Inp32", "short", 0x379)
MsgBox(0, "In2", "@Error: " & @error & @LF & "Result: " & Number($r))

This should be returning the state of the parallel port's four input pins.

It seems to return nothing. Using this function from C I get decimal 127 (hex 007F).

AutoIt should be able to interpret that return data, or not?

Thanks,

Kendall

Edit: See first post for correct DLL copy.

Edited by lte5000
Link to comment
Share on other sites

Larry, that is so great!

Thank you many times over...

Edit: I should have read the DLLCall() docs, sorry...

DLLCall docs...

...Otherwise an array is returned that contains the function return value and a copy of all the parameters (including parameters that the function may have modified)...

Thanks again,

Kendall

Edited by lte5000
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...