|
先用PLATFORM BULIDER或EVC 写一个IO流驱动程序,竖最好做成系统自动加载的.然后在VS2005 C#程序调用如下函数就可访问到IO了:
[DllImport("coredll.dll")]
private static extern IntPtr CreateFile(
String lpFileName, //file name
UInt32 dwDesiredAccess, //access mode
UInt32 dwShareMode, //share mode
IntPtr lpSecurityAttributes, //Security Attributes
UInt32 dwCreationDisposition, //how to create
UInt32 dwFlagsAndAttributes, //file attributes
IntPtr hTemplateFile //handle to template file
);
[DllImport("coredll.dll")]
public static extern bool ReadFile(
System.IntPtr h_comm,
int[] text,
int length,
ref int length2,
IntPtr overlap
);
[DllImport("coredll.dll")]
public static extern bool WriteFile(
System.IntPtr h_comm,
ref Byte WTtext,//Byte[] text,
int length,
ref int length2,
IntPtr overlap
);
如楼主还不清楚可留下邮箱,我发一个给你.
|
|