打印时,能不能控制走纸,打印多少纸就走多少?针打或喷墨 我做了打印的程序,就是将列表框里的文本打印出来,可是按照一般书上所说的,不管打印多少字,打印完都会把这页纸退出来,这样太浪费纸了,能不能打印多少,就走多少纸,能不能控制走纸 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 只能控制针打用 CreateFile("\\LPT1:", ..........);WriteFile("打印文本\r\n");打多少走多少,看我写的程序//打印字符到默认的打印机void CPrintDlg::PrintfStrToDefPrinter(CString strPrint){ HANDLE hPrint = CreateFile(m_steAlertPrinterPort,GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if( !hPrint) return ; //Setup for overlapped I/O COMMTIMEOUTS CommTimesOuts; CommTimesOuts.ReadIntervalTimeout = 1000; CommTimesOuts.ReadTotalTimeoutMultiplier = 2; CommTimesOuts.ReadTotalTimeoutConstant = 1000 ; CommTimesOuts.WriteTotalTimeoutMultiplier = 0 ; CommTimesOuts.WriteTotalTimeoutConstant = 500; SetCommTimeouts(hPrint,&CommTimesOuts); DWORD dwWritted = 0; strPrint += "\r\n"; int nLength = 0 ; nLength = strPrint.GetLength(); WriteFile(hPrint,strPrint.GetBuffer(nLength),nLength,&dwWritted,NULL); CloseHandle(hPrint);} 求解决方法,请大家帮帮忙 VS2008中如何调试动态库?我想要的是从EXE单步调试时进DLL 在VC中,安装MSDE失败...........在线等 GByte是什么类型? 如何设置对框上控件的字体,谁能给我指点一下??? 怎样调用WINDOWS中资源管理器的搜索功能? 32位机器上float 的表示 16位怎么表示 为什么我做的控件在JavaScript中调用时,会出“安全提问”?,急,请指教! 不看不要后悔!!! 一个程序员的烦恼,痛苦,无奈...... 怎么才能在对话框没打开时,就设置为(SW_HIDE) vc++6.0中使用CString和string问题!?
void CPrintDlg::PrintfStrToDefPrinter(CString strPrint)
{
HANDLE hPrint = CreateFile(m_steAlertPrinterPort,GENERIC_READ|GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL); if( !hPrint)
return ; //Setup for overlapped I/O
COMMTIMEOUTS CommTimesOuts; CommTimesOuts.ReadIntervalTimeout = 1000;
CommTimesOuts.ReadTotalTimeoutMultiplier = 2;
CommTimesOuts.ReadTotalTimeoutConstant = 1000 ; CommTimesOuts.WriteTotalTimeoutMultiplier = 0 ;
CommTimesOuts.WriteTotalTimeoutConstant = 500; SetCommTimeouts(hPrint,&CommTimesOuts); DWORD dwWritted = 0; strPrint += "\r\n";
int nLength = 0 ;
nLength = strPrint.GetLength(); WriteFile(hPrint,strPrint.GetBuffer(nLength),nLength,&dwWritted,NULL); CloseHandle(hPrint);
}