好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

HowcanIaccessParallelPortthroughaprintertoprintRF

Using CreateFile and WriteFile from win32 api: [DllImport( " kernel32.dll " )] private static extern int CreateFile( string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes, int dwCreationDisposition, int dwFlags

Using CreateFile and WriteFile from win32 api:

[DllImport( "  kernel32.dll   "  )]
  private   static   extern   int   CreateFile(
      string   lpFileName,
      uint   dwDesiredAccess,
      int   dwShareMode,
      int   lpSecurityAttributes,
      int   dwCreationDisposition,
      int   dwFlagsAndAttributes,
      int   hTemplateFile);

[DllImport(  "  kernel32.dll   "  )]
privatestaticextern   bool   WriteFile(
      int   hFile,
      byte  [] lpBuffer,
      int   nNumberOfBytesToWrite,
      ref   int   lpNumberOfBytesWritten,
      ref     OVERLAPPED lpOverlapped
  );
iHandle  =CreateFile( "  lpt1   " , 0x40000000 , 0 , 0 , 3 , 0 , 0 );

byte [] mybyte = System.Text.Encoding.Default.GetBytes(Mystring); bool b =WriteFile(iHandle, mybyte, mybyte.Length, ref i, ref x);

It can transport barcode command and print barcode well, but it can not read the status from the parallel port.

查看更多关于HowcanIaccessParallelPortthroughaprintertoprintRF的详细内容...

  阅读:46次