不知道对你有没有用,下面的代码是用来打开接在打印口上的钱箱的!!Var
  Mytext: TextFile;
  buf: String;
Begin
  Try
    assignFile(Mytext, 'LPT1');
    Rewrite(mytext);
    buf := chr(27) + chr(112) + chr(0) + chr(21) + chr(32);
    writeln(Mytext, buf);
    closefile(mytext);
  Except
    closefile(mytext);
  End;

解决方案 »

  1.   

    先用函数 lpFileName='lpt1'    HANDLE CreateFile(    LPCTSTR lpFileName, // pointer to name of the file 
        DWORD dwDesiredAccess, // access (read-write) mode 
        DWORD dwShareMode, // share mode 
        LPSECURITY_ATTRIBUTES lpSecurityAttributes, // pointer to security attributes 
        DWORD dwCreationDistribution, // how to create 
        DWORD dwFlagsAndAttributes, // file attributes 
        HANDLE hTemplateFile  // handle to file with attributes to copy  
       ); 创建一个并口句柄
    然后创建线程用ReadFile(    HANDLE hFile, // handle of file to read 
        LPVOID lpBuffer, // address of buffer that receives data  
        DWORD nNumberOfBytesToRead, // number of bytes to read 
        LPDWORD lpNumberOfBytesRead, // address of number of bytes read 
        LPOVERLAPPED lpOverlapped  // address of structure for data 
       );对其进行监视即可