各位大虾:
我现在做了一个数据库的连续记录表,大概有几百条记录,我要将这些记录全部连续打印出来,我用的是Epson 630K 的打印机,它打印时,只打印了一页A4纸的内容后,打印机就停止打印了,不能连续打印.部分代码如下:
//定义一个打印作业
DOCINFO di={sizeof(DOCINFO),"printer",NULL};
// 得到设备字符串存入数组szprinter中
GetProfileString("windows","device",",,,",szprinter,80);
// 将设备字符串分解
if(NULL!=(szDevice=strtok(szprinter,",")) && NULL != (szDriver=strtok(NULL,",")) && NULL!=(szOutput=strtok(NULL,",")))
///////////////////////////////////////////////////////////
if((hdcprint=CreateDC(szDriver,szDevice,szOutput,NULL))!=0)
{ // 创建一个打印机设备句柄
if(StartDoc(hdcprint,&di)>0) //开始执行一个打印作业
{
StartPage(hdcprint); //打印机走纸,开始打印
SaveDC(hdcprint); //保存打印机设备句柄
temp = zhan_name;
TextOut(hdcprint,300,40,temp,temp.GetLength());
temp = "每罐配料情况表";
TextOut(hdcprint,500,100,temp,temp.GetLength()); // 输出一行文字 m_Set.MoveFirst();
while(!m_Set.IsEOF())
{
temp = "流水号:";
TextOut(hdcprint,xx7+5,yy1+5-yy, temp,temp.GetLength());
temp.Format("%d",m_Set.m_bianhao);
TextOut(hdcprint,xx8+5,yy1+5-yy,temp,temp.GetLength()); temp = "工单号";
TextOut(hdcprint,xx1+5,yy1+5, temp,temp.GetLength());
TextOut(hdcprint,xx2+5,yy1+5, m_Set.MoveNext(); }
RestoreDC(hdcprint,-1); //恢复打印机设备句柄
EndPage(hdcprint); //打印机停纸,停止打印
EndDoc(hdcprint); //结束一个打印作业
//MessageBox("打印完毕!","提示",MB_ICONINFORMATION);
}
// 用API函数DeleteDC销毁一个打印机设备句柄
DeleteDC(hdcprint);
}
else
{
MessageBox("没有默认打印机,或者没有安装打印机!");
return;
} ////////////////////////////////////////////////////////////关于报表数据不能连续打印的问题?
我现在做了一个数据库的连续记录表,大概有几百条记录,我要将这些记录全部连续打印出来,我用的是Epson 630K 的打印机,它打印时,只打印了一页A4纸的内容后,打印机就停止打印了,不能连续打印.部分代码如下:
//定义一个打印作业
DOCINFO di={sizeof(DOCINFO),"printer",NULL};
// 得到设备字符串存入数组szprinter中
GetProfileString("windows","device",",,,",szprinter,80);
// 将设备字符串分解
if(NULL!=(szDevice=strtok(szprinter,",")) && NULL != (szDriver=strtok(NULL,",")) && NULL!=(szOutput=strtok(NULL,",")))
///////////////////////////////////////////////////////////
if((hdcprint=CreateDC(szDriver,szDevice,szOutput,NULL))!=0)
{ // 创建一个打印机设备句柄
if(StartDoc(hdcprint,&di)>0) //开始执行一个打印作业
{
StartPage(hdcprint); //打印机走纸,开始打印
SaveDC(hdcprint); //保存打印机设备句柄
temp = zhan_name;
TextOut(hdcprint,300,40,temp,temp.GetLength());
temp = "每罐配料情况表";
TextOut(hdcprint,500,100,temp,temp.GetLength()); // 输出一行文字 m_Set.MoveFirst();
while(!m_Set.IsEOF())
{
temp = "流水号:";
TextOut(hdcprint,xx7+5,yy1+5-yy, temp,temp.GetLength());
temp.Format("%d",m_Set.m_bianhao);
TextOut(hdcprint,xx8+5,yy1+5-yy,temp,temp.GetLength()); temp = "工单号";
TextOut(hdcprint,xx1+5,yy1+5, temp,temp.GetLength());
TextOut(hdcprint,xx2+5,yy1+5, m_Set.MoveNext(); }
RestoreDC(hdcprint,-1); //恢复打印机设备句柄
EndPage(hdcprint); //打印机停纸,停止打印
EndDoc(hdcprint); //结束一个打印作业
//MessageBox("打印完毕!","提示",MB_ICONINFORMATION);
}
// 用API函数DeleteDC销毁一个打印机设备句柄
DeleteDC(hdcprint);
}
else
{
MessageBox("没有默认打印机,或者没有安装打印机!");
return;
} ////////////////////////////////////////////////////////////关于报表数据不能连续打印的问题?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货