符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
Public Function EnumPrinters()
10年积累的成都网站制作、成都网站建设经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站策划后付款的网站建设流程,更有嘉黎免费网站建设让你可以放心的选择与我们合作。
Dim PrinterSQL As String =
"SELECT * FROM Win32_Printer"
Dim
printers As Management.ManagementObjectCollection = New
Management.ManagementObjectSearcher(PrinterSQL).Get()
Dim printer As
Management.ManagementObject
For
Each printer In
printers
Dim pde As Management.PropertyDataCollection.PropertyDataEnumerator =
printer.Properties.GetEnumerator
While
(pde.MoveNext)
Try
If pde.Current.Name = "DriverName"
Then
combobox1.Items.Add(pde.Current.Value.ToString)
End
If
Catch ex As
Exception
MessageBox.Show(ex.ToString)
End
Try
End
While
Next
End Function
Const HKLM = H80000002 '定义根键常数
'其他常用根键 Const HKCR = H80000000 , Const HKCU = H80000001
Set oReg = GetObject("winmgmts:\\.\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
oReg.EnumKey HKLM, strKeyPath, arrSubKeys '枚举子项,赋值给数组arrSubKeys
For Each subkey In arrSubKeys
Print subkey
Next
For Each x In Printers
FindPrinter strPrint, x.DeviceName
next
Function FindPrinter(ByRef PrinterName As String, Optional ByVal PrinterDescription As String = "") As Boolean
' 查指定打印机
Dim objRegistry As Object
Dim arrSubKeys As Variant
Dim subkey As Variant
Dim KeyValue As Variant
If Len(PrinterDescription) 0 Then
Set objRegistry = GetObject("winmgmts:\\.\root\default:StdRegProv")
objRegistry.EnumValues H80000001, "Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts", arrSubKeys
For Each subkey In arrSubKeys
If InStr(1, subkey, PrinterDescription) Then
objRegistry.GetStringValue H80000001, "Software\Microsoft\Windows NT\CurrentVersion\PrinterPorts\", subkey, KeyValue
PrinterName = subkey " 在 " Mid(KeyValue, InStr(KeyValue, ",") + 1, InStr(KeyValue, ":,") - InStr(KeyValue, ","))
FindPrinter = True
Exit For
End If
Next
Set objRegistry = Nothing
End If
End Function
打印机端口查看方法如下:
1、进入“控制面板”-“设备和打印机”;
2、右键需要查看的打印机,选择“属性”;
3、选择”Web服务“,即可查看IP端口。
我是VB.NET 2010版本
窗体上添加一个按钮,代码如下:
Imports System.Drawing.Printing
Public Class Form1
'采用关键字WithEvents声明一个PrintDocument对象,会引发它的PrintPage事件
Private WithEvents My_PrintDocument As PrintDocument
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'实例化PrintDocument对象
My_PrintDocument = New PrintDocument
'显示默认的打印机名称
MsgBox(My_PrintDocument.PrinterSettings.PrinterName)
'显示默认的打印机纸张类型名称
MsgBox(My_PrintDocument.DefaultPageSettings.PaperSize.ToString)
End Sub
End Class