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 谢谢大家的回复

解决方案 »

  1.   

    USB口的打印机?那首先还是要对USB口进行设备驱动吧,打印机的指令这个你要找你的打印机厂家要啊,不同的厂家给出的指令是不一样的
      

  2.   

    已经驱动好了,用WORD打印一切正常,我现在就想直接把数据输出到打印机,可是不知道怎么打开这个USB口的打印机
      

  3.   

    windows驱动打印,不明白意思,能否详细说明,谢谢
      

  4.   

    即然能用word打印了
    那应该就可以使用printdocument这个类来打印呀!
      

  5.   

    http://hi.baidu.com/bdhseaside/blog/item/65fb88e975b1e83bb90e2dc5.html
    可以参考一下这个例子!
      

  6.   

    怎么这么多的人用Com空件啊!!
    关注!!
      

  7.   

    private const uint GENERIC_READ = 0x80000000; 
    private const uint GENERIC_WRITE = 0x40000000; 
    private const int OPEN_EXISTING = 3; 
    这三个字段是什么意思啊