VB6 获取和设置默认打印机】的更多相关文章

Private Declare Function GetProfileString Lib "kernel32" Alias "GetProfileStringA" (ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long) As LongFunction…
实现如下效果: 实现方式如下: using System;using System.Drawing.Printing;using System.Runtime.InteropServices;using System.Windows.Forms; namespace PISS.View.CustomControl{ public partial class PrinterConfigMessBox : Form { #region 定义.构造.初始化 [DllImport("winspool.d…
项目中,需要选择打印机,切换打印机.demo如下(wpf应用程序): Xaml: <Window x:Class="PrintersApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWin…
实现这个功能需要使用windows api [DllImport("winspool.drv")] public static extern bool SetDefaultPrinter(String Name); //调用win api将指定名称的打印机设置为默认打印机 private static PrintDocument PrintDocument = new PrintDocument(); public static void SetDefaultPrint(string…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Configuration; using System.Drawing.Printing; using System.Runtime.InteropServices; using System.Drawing; namespace Demo { public class SettingConfigur…
Winform 判断打印机是否可用,实现设置默认打印机功能 http://www.cnblogs.com/zfanlong1314/p/3878563.html…
本文主要介绍如何获取以及设置系统的默认打印机. 1.获取系统中的所有打印机 获取系统中的所有打印机可以使用EnumPrinters()函数,该函数可以枚举全部的本地.网络打印机信息.其函数原型为: BOOL WINAPI EnumPrinters( DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned ); 其中,参数Flags可以…
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Med…
通常web技术无法设置本地计算机的默认打印机,包括用代码设置纸张大小,如果业务系统中真遇到这种需求,只能通过其它辅助手段(比如ActiveX)实现.下面这段代码,出自网上被广泛使用的"泥人张打印API"(抱歉未找到原始出处),已经用C#封装了很多关于底层打印的API方法 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; usin…
打印机采用局域网网络连接方式,下面以Windows系统为例说明如何添加此打印机. 将电脑接入局域网 在“控制面板”中打开“设备与打印机”,点击“添加打印机” 在弹出列表中,会自动出现打印机型号,选中它进行下一步(进到6) 若没有自动显示打印机,选择“我所需的打印机未列出”,在其他选项对话框中,选择“使用TCP/IP地址或主机名添加打印机” 在主机名或IP地址栏中键入打印机地址,形如192.168.1.X,点击下一步 在驱动列表中选择相应的打印机型号 若没有该型号,则点击“Windows更新”以刷…