Delphi获取默认打印机名称及端口】的更多相关文章

Delphi获取默认打印机名称及端口 在前段时间写的收银系统中由于目前市场上很多电脑主板上已经没有并口,而POS机却又需要并口,所以目前需要用PCI转接卡,这个就导致不同门店使用的端口就有可能不同,这就给我们程序中弹出钱箱的指令带来一定的难度.所以就通过获取Window自带的默认,得出打印机信息. 在Windows文件下有个win.ini,里面自带默认打印机的信息.通过调用API函数Getprofilestring这个函数获取打印机信息.   在界面上拖个button,在其单击事件中写: pro…
如何获取默认打印机的状态,包括缺纸.卡纸.无连接等状态,还有将某文件打印后,如何得知打印成功? Option ExplicitDeclare Function MapPhysToLin Lib "WinIo.dll" (ByVal PhysAddr As Long, ByVal PhysSize As Long, ByRef PhysMemHandle) As LongDeclare Function UnmapPhysicalMemory Lib "WinIo.dll&qu…
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…
获取默认打印机: SELECT * FROM Win32_Printer WHERE Default=True 常用的几个WMI: 主板:Win32_BaseBoard http://msdn.microsoft.com/en-us/library/aa394072(VS.85).aspx CPU:  Win32_Processor  http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx 显卡:Win32_VideoContro…
通常web技术无法设置本地计算机的默认打印机,包括用代码设置纸张大小,如果业务系统中真遇到这种需求,只能通过其它辅助手段(比如ActiveX)实现.下面这段代码,出自网上被广泛使用的"泥人张打印API"(抱歉未找到原始出处),已经用C#封装了很多关于底层打印的API方法 using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; usin…
实现如下效果: 实现方式如下: 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…
List<string> print = Cprinter.GetLocalPrinter(); /// <summary> /// 获取所有打印机 /// </summary> public class Cprinter { private static PrintDocument fPrintDocument = new PrintDocument(); ///<summary> ///获取本地默认打印机名称 ///</summary> pu…
项目中,需要选择打印机,切换打印机.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…
本文主要介绍如何获取以及设置系统的默认打印机. 1.获取系统中的所有打印机 获取系统中的所有打印机可以使用EnumPrinters()函数,该函数可以枚举全部的本地.网络打印机信息.其函数原型为: BOOL WINAPI EnumPrinters( DWORD Flags, LPSTR Name, DWORD Level, LPBYTE pPrinterEnum, DWORD cbBuf, LPDWORD pcbNeeded, LPDWORD pcReturned ); 其中,参数Flags可以…
JS <script language="javascript"> function startRequest() { var oShell = new ActiveXObject("WScript.Shell"); var sRegVal = 'HKEY_CURRENT_USER\\Software\\Microsoft\\Windows NT\\CurrentVersion\\Windows\\Device'; var sDefault = oShe…