Hello,
i´ve tested the DIO Driver and have some problems while implementing.
The output functions working well over WriteFile(), but input reading via ReadFile()
makes some trouble. It ended every time with errorcode 12 ( ERROR_INVALID_ACCESS )
Code
- [DllImport("coredll.dll")]
- private static extern int ReadFile(IntPtr hFile, byte[] lpBuffer, int nNumberOfBytesToRead, out int lpNumberOfBytesRead, IntPtr lpOverlapped);
- public string ReadInput()
- {
- System.Text.Encoding encoding = System.Text.Encoding.Default;
- int ptr_read = ReadFile(handle, buffer, 1, ref read, IntPtr.Zero);
- if (ptr_read != 0)
- {
- return encoding.GetString(buffer,0,1);
- }
- return "";
- }
Any Solutions ?
best reguards
Ch. Hartensteiner