lte5000 Posted September 23, 2005 Posted September 23, 2005 (edited) 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,KendallEdit1: Tidy.Edit2: Tidy and add info.Edit3: Tidy and add info.Edit4: Correction.inpout32.dll Edited September 27, 2005 by lte5000
lte5000 Posted September 23, 2005 Author Posted September 23, 2005 I updated a few things. See first post.
Valik Posted September 23, 2005 Posted September 23, 2005 Larry, __stdcall is correct. It would still work if it were __cdecl, however, there would be a memory leak as the stack wouldn't be cleaned up.
lte5000 Posted September 24, 2005 Author Posted September 24, 2005 Hmm, does this mean something to me? Maybe I should just use another solution. Thanks, Kendall
RAMzor Posted September 25, 2005 Posted September 25, 2005 Hi! Try this $BasePortAddr = 0x378 $ReadLpt = DllCall ( "inpout32.dll", "int", "Out32", "int", $BasePortAddr, "int", 0 )
lte5000 Posted September 25, 2005 Author Posted September 25, 2005 (edited) 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.KendallEdit: Thanks for the support, everyone. Edited September 25, 2005 by lte5000
lte5000 Posted September 27, 2005 Author Posted September 27, 2005 (edited) 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,KendallEdit: See first post for correct DLL copy. Edited September 27, 2005 by lte5000
lte5000 Posted September 27, 2005 Author Posted September 27, 2005 (edited) 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 September 27, 2005 by lte5000
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