public bool Write(byte[] mybyte) { if (this.iHandle != -1) { LptControl.OVERLAPPED oVERLAPPED = default(LptControl.OVERLAPPED); int num = 0; return(LptControl.WriteFile(this.iHandle, mybyte, mybyte.Length, ref num, ref oVERLAPPED)); } throw new Exception("[Pos 3002] 不能连接到打印机!"); }
public bool Write(string Mystring) { if (this.iHandle != -1) { LptControl.OVERLAPPED oVERLAPPED = default(LptControl.OVERLAPPED); int num = 0; byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(Mystring); return(LptControl.WriteFile(this.iHandle, bytes, bytes.Length, ref num, ref oVERLAPPED)); } throw new Exception("[Pos 3001] 不能连接到打印机!"); }
private static extern bool WriteFile(int hFile, byte[] lpBuffer, int nNumberOfBytesToWrite, ref int lpNumberOfBytesWritten, ref LptControl.OVERLAPPED lpOverlapped);