p/invoke the win32 CreateFile, WriteFile, ReadFile, CloseHandle from
coredll.dll (see below). Call CreateFile with "COM1:" for eample and hey
presto you have an IntPtr to an open com port. From there use this handle
with the other stuff.
You might wanna create a class to wrap all this stuff to make it more OO and
to implement IDisposable on it.
[DllImport("coredll.dll")]
private static extern bool CloseHandle(IntPtr hObject);
[DllImport("coredll.dll")]
private static extern bool WriteFile(IntPtr hFile, byte[] lpBuffer, Int32
nNumberOfBytesToWrite, ref Int32 lpNumberOfBytesWritten, IntPtr
lpOverlapped);
[DllImport("coredll.dll")]
private static extern bool ReadFile(IntPtr hFile, byte[] lpBuffer, Int32
nNumberOfBytesToRead, ref Int32 lpNumberOfBytesRead, IntPtr lpOverlapped);
[DllImport("coredll.dll")]
private static extern IntPtr CreateFile( string lpFileName,
UInt32 dwDesiredAccess,
UInt32 dwShareMode,
IntPtr lpSecurityAttributes,
UInt32 dwCreationDisposition,
UInt32 dwFlagsAndAttributes,
IntPtr hTemplateFile);
"IanHale" <Ia*****@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
Thanks Cor
Sorry if I'm being a bit slow - but the search turned up many entries -
none
of which seemed to answer simple question - do you know of any simple
guide
on getting going. I even tried looking up Dick's book on Amazon - but they
claim a 6-8 week delivery (if at all!)
"Cor Ligthert" wrote:
IanHale,
You can use it, just look in the newsgroups on Dick Grier
http://groups-beta.google.com/groups...=Search+Groups
I hope this helps
Cor