private string prnPort = "LPT1"; //打印机端口private const uint GENERIC_READ = 0x80000000;
private const uint GENERIC_WRITE = 0x40000000;
private const int OPEN_EXISTING = 3; /// <summary>
/// 打开一个vxd(设备)
/// </summary>
[DllImport("kernel32.dll", EntryPoint = "CreateFile", CharSet = CharSet.Auto)]
private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes,
int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
用这个可以打开并口连接的打印机,可是我换成USB线,把“LPT1” 改成“USB001”却打不开了,
请问如何打开USB口的打印机,还有如何给打印机发指令
我的打印机是EPSON PLQ-20k 谢谢大家的回复
private const uint GENERIC_WRITE = 0x40000000;
private const int OPEN_EXISTING = 3; /// <summary>
/// 打开一个vxd(设备)
/// </summary>
[DllImport("kernel32.dll", EntryPoint = "CreateFile", CharSet = CharSet.Auto)]
private static extern IntPtr CreateFile(string lpFileName, uint dwDesiredAccess, int dwShareMode, int lpSecurityAttributes,
int dwCreationDisposition, int dwFlagsAndAttributes, int hTemplateFile);
用这个可以打开并口连接的打印机,可是我换成USB线,把“LPT1” 改成“USB001”却打不开了,
请问如何打开USB口的打印机,还有如何给打印机发指令
我的打印机是EPSON PLQ-20k 谢谢大家的回复
那应该就可以使用printdocument这个类来打印呀!
可以参考一下这个例子!
关注!!
private const uint GENERIC_WRITE = 0x40000000;
private const int OPEN_EXISTING = 3;
这三个字段是什么意思啊