c#关于检测打印机,各位大虾请赐教

铛铛 2010-03-13 12:58:24
请问我如何判断一台电脑是否连接到了可用的打印机,以及获得打印机的纸张大小(A3或A4等)、单面或双面打印、纸盒内有没有纸、任务列表等,最好是贴出部分源码,谢谢!!!!
...全文
1258 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Binea 2011-08-23
  • 打赏
  • 举报
回复
mark
lzsh0622 2010-03-13
  • 打赏
  • 举报
回复
铛铛 2010-03-13
  • 打赏
  • 举报
回复
SELECT * FROM Win32_Printer

查处一大堆属性,谁给解释一下啊
铛铛 2010-03-13
  • 打赏
  • 举报
回复
to wuyq11:
我也想过用WMI,能具体点吗?谢谢
wuyq11 2010-03-13
  • 打赏
  • 举报
回复
枚举打印机
System.Management.ManagementClass mc =new ManagementClass("Win32_Printer")
System.Management.ManagementObjectCollection mocs = mc.GetInstances();

[DllImport("shell32.dll", CharSet=CharSet.Auto)]
public static extern Int32 SHInvokePrinterCommand(
IntPtr hwnd, UInt32 uAction, [MarshalAs(UnmanagedType.LPWStr)]
String lpBuf1,
[MarshalAs(UnmanagedType.LPWStr)]
String lpBuf2,
Int32 fModal);

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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