并口打印机问题!

christopher_hp 2006-10-30 10:57:37
用CreateFile打印并口打印,用WriteFile来打印,请教怎么取得打印机状态和复位打印机呢?有没有直接API可以完成的,比如使用文件IO控制函数?
...全文
448 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
christopher_hp 2006-11-08
  • 打赏
  • 举报
回复
清除错误状态命令
就是这个东西,偶要了,但是命令也要用writefile写下去了,不然怎么控制呢
zhyt_213 2006-11-01
  • 打赏
  • 举报
回复
你找EPSON要一份命令手册就可以了。
出错后不是WriteFile不能写,是要先发一个清除错误状态命令然后打印机才会响应
christopher_hp 2006-11-01
  • 打赏
  • 举报
回复
直接对口操作的偶会,不过觉得既然有系统的函数,就想用系统函数
BenLeak 2006-11-01
  • 打赏
  • 举报
回复
我觉得还是使用 IO 控制比较简单了,这个资料搜索一下就有了
一般 LPT1 = 0x378
christopher_hp 2006-10-31
  • 打赏
  • 举报
回复
但是如果打印机出错之后,或者缺纸之后WriteFile就不能写东西了啊,怎么做复位操作呢?
偶用的EPSON的BAT500,你用的什么啊?
kysoft 2006-10-31
  • 打赏
  • 举报
回复
up
vc8fans 2006-10-30
  • 打赏
  • 举报
回复
参考直接访问和控制电脑的打印口(并行口)
for Windows 98/ME/NT/2000/XP/2003
http://www.cppfans.com/articles/system/prnport.asp
用winIO包可以解决
我不懂电脑 2006-10-30
  • 打赏
  • 举报
回复
BCB提供了TPrinter操作打印机。
Retrieves information about the current printer.

void __fastcall GetPrinter(char * ADevice, char * ADriver, char * APort, int &ADeviceMode);

Description

Call GetPrinter to obtain information about the current printer.

ADevice is a buffer that receives the device name of the current printer. This is the name that appears in the Print Manager (for example, "Epson FX-80"). It is not the printer model name.

ADriver is a buffer that receives the driver name for the current printer. Some versions of Windows do not use printer driver names, in which case this buffer is unused. On versions of Windows that support printer driver names, this is the name of a printer driver (usually 慦INSPOOL?.

APort is a buffer that receives the port used by the current printer. It is not used on 32-bit versions of Windows, but is included for backward compatibility.

DeviceMode returns the handle to a memory buffer containing a DEVMODE structure, which contains device-specific initialization data for the device driver. Use the GlobalLock function to convert this handle into a pointer to the structure.
zhyt_213 2006-10-30
  • 打赏
  • 举报
回复
这种我做过,关键是你要得到打印机的命令及返回手册,然后根据打印机的命令手册先设好打印机自动返回错误状态或每次操作完后再写命令来获取打印机状态即可。
函数就用CreateFile和WriteFile和ReadFile就可以了。
christopher_hp 2006-10-30
  • 打赏
  • 举报
回复
我用的是标准的并口打印机,没有装驱动,WINDOWS认不到的,但是可以直接通过写并口文件来打印,主要就打印状态和复位做不到.
在WINIO是对口直接操作吧?有没有其他的函数可以完成呢?
比如文件控制IO的函数,驱动IO控制函数?

1,221

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧