-
parallel port
Anyone have any tips on how to access the parallel port in C code - i'm thinking using outp at some address, but i don't know the address of the parallel port. is all the data i need for accessing it in the device manager on my control panel? and finally, how can i access the port directly?
thanks
-
Re: parallel port
You're in the wrong message board, but if you do a CreateFile and pass in the file name "COM1" you can open a com port. I'd assume passing in "LPT1" would open that port as well.
-
Sorry, I can't help you at the moment but I am working on a comport wrapper/driver. Due to some problems in the .NET code it's not possible for me to give you the files you need.
I will look also for a wrapper around the COM code for the parallel port.
-
Has anyone become any wiser regarding this subject?
This is something I have used in c++ but how can I use api functions like CreateFile in c#?
Maybe there is a better way?
All help appretiated.
s2 = "Kalle";
s = "LPT1";
h = CreateFile(s,GENERIC_WRITE or
GENERIC_READ,0,nil,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if (h = INVALID_HANDLE_VALUE)
{
b= false;
}
b = WriteFile(h,s2 ,5,written,nil);
CloseHandle(h);
-
Code:
[DllImport("kernel32.dll")]
public external int CreateFile(.......)
The DllImport Attribute can be used to import API functions from other COM Dll files and Win32 dll files. So this can also be used to import windows API Functions into C#.