我要控制打印机打印发票一类的小纸条~要逐行打印~~请高手指点~给出例子更好啊!!
[email protected]!
谢谢!

解决方案 »

  1.   

    可以用winio来实现 
    采用查询方式进行打印
    对并口的状态位进行控制 逐行输出字符
     可以参考我以前的帖  http://community.csdn.net/Expert/topic/3664/3664042.xml?temp=.5979425
      

  2.   

    命令行的
    copy print.txt prn
    程序的
    hLpt1=CreatFile("LPT1");
    hPrint=CreatFile("print.txt");
    ReadFile(hPrint,buffer)
    WriteFile(hLpt1,buffer);用winio实现,好像不是很必要
      

  3.   

    用普通的打印机实现这种功能,好像须用CPL语言控制打印机!
      

  4.   

    BOOL RawDataToPrinter(LPSTR szPrinterName, LPBYTE lpData, DWORD dwCount)
       {
         HANDLE     hPrinter;
         DOC_INFO_1 DocInfo;
         DWORD      dwJob;
         DWORD      dwBytesWritten;     // Need a handle to the printer.
         if( ! OpenPrinter( szPrinterName, &hPrinter, NULL ) )
           return FALSE;     // Fill in the structure with info about this "document."
         DocInfo.pDocName = "My Document";
         DocInfo.pOutputFile = NULL;
         DocInfo.pDatatype = "RAW";
         // Inform the spooler the document is beginning.
         if( (dwJob = StartDocPrinter( hPrinter, 1, (LPSTR)&DocInfo )) == 0 )
         {
           ClosePrinter( hPrinter );
           return FALSE;
         }
         // Start a page.
         if( ! StartPagePrinter( hPrinter ) )
         {
           EndDocPrinter( hPrinter );
           ClosePrinter( hPrinter );
           return FALSE;
         }
         // Send the data to the printer.
         if( ! WritePrinter( hPrinter, lpData, dwCount, &dwBytesWritten ) )
         {
           EndPagePrinter( hPrinter );
           EndDocPrinter( hPrinter );
           ClosePrinter( hPrinter );
           return FALSE;
         }
         // End the page.
         if( ! EndPagePrinter( hPrinter ) )
         {
           EndDocPrinter( hPrinter );
           ClosePrinter( hPrinter );
           return FALSE;
         }
         // Inform the spooler that the document is ending.
         if( ! EndDocPrinter( hPrinter ) )
         {
           ClosePrinter( hPrinter );
           return FALSE;
         }
         // Tidy up the printer handle.
         ClosePrinter( hPrinter );
         // Check to see if correct number of bytes were written.
         if( dwBytesWritten != dwCount )
           return FALSE;
         return TRUE;
       }