怎么获得系统默认打印机的名称?请大家帮忙
如题
------解决方案--------------------PrintDialog dlg = new PrintDialog();
Console.Write(dlg.PrinterSettings.DefaultPageSettings.PrinterSettings.PrinterName);
------解决方案--------------------我已贴了代码 后面这个只是额外说说
------解决方案--------------------声明
[DllImport( "winspool.drv " )]
public static extern int GetDefaultPrinter( System.IntPtr ptr , ref int size );
调用
int size = 0;
int n = GetDefaultPrinter( IntPtr.Zero , ref size );
System.IntPtr ptr = Marshal.AllocHGlobal( size );
n= GetDefaultPrinter( ptr , ref size );
String strprint = Marshal.PtrToStringAnsi( ptr , size );