散分... 放假咯,明天回家。祝各位新年快乐。。回家再结贴,嘿嘿 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jf jf 楼主虎虎生威~~~~~ /*//从并行端口读取打印机状态function GetPrinterStatus:byte;asm MOV DX,$379; IN AL,DX;end;//获取打印机是否出错function CheckPrinter:boolean;vartemp:byte;begin temp:=GetPrinterStatus; Result:=not ( ((temp and $80)=0) //打印机忙 or ((temp and $20)<>0) //打印机缺纸 or ((temp and $10)=0) //打印机未联机 or ((temp and $08)=0) ); //打印机出错;end;*/unsigned char GetPrinterStatus(){ asm { MOV DX,0x379 }}bool LptPrint(char prtdata[],int prtlen,int timeout){ HANDLE h; DWORD n; COMMTIMEOUTS t; bool result=true; h = CreateFile("lpt1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); if (h == INVALID_HANDLE_VALUE){ //AfxMessageBox("Can not open lpt1"); return false; } t.ReadIntervalTimeout = 0; t.ReadTotalTimeoutMultiplier = 0; t.ReadTotalTimeoutConstant = 0; t.WriteTotalTimeoutMultiplier = timeout * 1000 / prtlen; t.WriteTotalTimeoutConstant = 0; if (!SetCommTimeouts(h,&t)){ //AfxMessageBox("SetCommTimeout error"); return false; } result = true; /* if (!WriteFile(h,prtdata,prtlen,&n,NULL)){ //AfxMessageBox("Print error"); result = false; } */ CloseHandle(h); return result;}/*//从并行端口读取打印机状态function GetPrinterStatus:byte;asm MOV DX,$379; IN AL,DX;end;//获取打印机是否出错function CheckPrinter:boolean;vartemp:byte;begin temp:=GetPrinterStatus; Result:=not ( ((temp and $80)=0) //打印机忙 or ((temp and $20)<>0) //打印机缺纸 or ((temp and $10)=0) //打印机未联机 or ((temp and $08)=0) ); //打印机出错;end;*/unsigned char GetPrinterStatus(){ asm { MOV DX,0x379 }}bool LptPrint(char prtdata[],int prtlen,int timeout){ HANDLE h; DWORD n; COMMTIMEOUTS t; bool result=true; h = CreateFile("lpt1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); if (h == INVALID_HANDLE_VALUE){ //AfxMessageBox("Can not open lpt1"); return false; } t.ReadIntervalTimeout = 0; t.ReadTotalTimeoutMultiplier = 0; t.ReadTotalTimeoutConstant = 0; t.WriteTotalTimeoutMultiplier = timeout * 1000 / prtlen; t.WriteTotalTimeoutConstant = 0; if (!SetCommTimeouts(h,&t)){ //AfxMessageBox("SetCommTimeout error"); return false; } result = true; /* if (!WriteFile(h,prtdata,prtlen,&n,NULL)){ //AfxMessageBox("Print error"); result = false; } */ CloseHandle(h); return result;} http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/onion/68.gif 为什么两个内容相等,但比较显示是不等的. 怎么获取美女的心,看看这些... 关于数据合法性验证的问题 master/detail 的例子﹐給在下一份﹐高分 构造函数问题 怎样一个程序获取其他当前应用程序的标题 有谁记得这样一句话?好象是一位高手说的:“受辱不惊.....看堂前花开花谢......" 用nmudp控件做intenet聊天程序,要消息重发吗(发送未成功等)?还是它自己会处理? 询问高手如何在Delphi中挂入操作日志文件及帮助文件 TB97,TB97Tlwn是什么? delphi7 和读卡器的连接问题 数组问题?欢迎人才来看看。
function GetPrinterStatus:byte;
asm
MOV DX,$379;
IN AL,DX;
end;
//获取打印机是否出错
function CheckPrinter:boolean;
var
temp:byte;
begin
temp:=GetPrinterStatus;
Result:=not ( ((temp and $80)=0) //打印机忙
or ((temp and $20)<>0) //打印机缺纸
or ((temp and $10)=0) //打印机未联机
or ((temp and $08)=0) ); //打印机出错;
end;*/
unsigned char GetPrinterStatus()
{
asm
{
MOV DX,0x379 }
}
bool LptPrint(char prtdata[],int prtlen,int timeout)
{
HANDLE h;
DWORD n;
COMMTIMEOUTS t;
bool result=true;
h = CreateFile("lpt1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
if (h == INVALID_HANDLE_VALUE){
//AfxMessageBox("Can not open lpt1");
return false;
} t.ReadIntervalTimeout = 0;
t.ReadTotalTimeoutMultiplier = 0;
t.ReadTotalTimeoutConstant = 0;
t.WriteTotalTimeoutMultiplier = timeout * 1000 / prtlen;
t.WriteTotalTimeoutConstant = 0;
if (!SetCommTimeouts(h,&t)){
//AfxMessageBox("SetCommTimeout error");
return false;
}
result = true;
/* if (!WriteFile(h,prtdata,prtlen,&n,NULL)){
//AfxMessageBox("Print error");
result = false;
}
*/
CloseHandle(h);
return result;
}/*//从并行端口读取打印机状态
function GetPrinterStatus:byte;
asm
MOV DX,$379;
IN AL,DX;
end;
//获取打印机是否出错
function CheckPrinter:boolean;
var
temp:byte;
begin
temp:=GetPrinterStatus;
Result:=not ( ((temp and $80)=0) //打印机忙
or ((temp and $20)<>0) //打印机缺纸
or ((temp and $10)=0) //打印机未联机
or ((temp and $08)=0) ); //打印机出错;
end;*/
unsigned char GetPrinterStatus()
{
asm
{
MOV DX,0x379 }
}
bool LptPrint(char prtdata[],int prtlen,int timeout)
{
HANDLE h;
DWORD n;
COMMTIMEOUTS t;
bool result=true;
h = CreateFile("lpt1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0);
if (h == INVALID_HANDLE_VALUE){
//AfxMessageBox("Can not open lpt1");
return false;
} t.ReadIntervalTimeout = 0;
t.ReadTotalTimeoutMultiplier = 0;
t.ReadTotalTimeoutConstant = 0;
t.WriteTotalTimeoutMultiplier = timeout * 1000 / prtlen;
t.WriteTotalTimeoutConstant = 0;
if (!SetCommTimeouts(h,&t)){
//AfxMessageBox("SetCommTimeout error");
return false;
}
result = true;
/* if (!WriteFile(h,prtdata,prtlen,&n,NULL)){
//AfxMessageBox("Print error");
result = false;
}
*/
CloseHandle(h);
return result;
}