Print into a msflexgrid, name fgd1, column number 4 ' Option Explicit
Private Const dc_maxextent = 5
Private Const dc_minextent = 4
Private Const dc_papernames = 16
Private Const dc_papers = 2
Private Const dc_papersize = 3
Private Declare Function devicecapabilities Lib "Winspool.drv" Alias "Devicecapabilitiesa" (ByVal lpdevicename as String, ByVal Lpport as String, ByVal Iindex as Long, lpoutput as any, lpdevmode as any) as long
Private Type POINTS
X as Long
Y as Long
End Type
Private Sub Form_Load ()
Dim I as Longwith fgd1
. Clear
. formatstring = "^ paper number |^ paper name |^ paper length |^ paper width"
For i = 0 to. Cols-1
. Colwidth (i) = 1700
Next I
. allowuserresizing = Flexresizecolumns
. left = 0
. Width = Me.scalewidth
End Withgetpaperinfoend SubPrivate Sub getpaperinfo ()
Dim I as long, ret as long
Dim Length As Integer, Width as Integer
Dim Paperno () as Integer, Papername () as String, PaperSize () as POINTS ' supports maximum printing paper:
RET = devicecapabilities (printer name, "LPT1", Dc_maxextent, ByVal 0&, ByVal 0&)
Length = ret \ 65536
Width = Ret-length * 65536
' Lblmaxlength.caption = Length
' lblmaxwidth.caption = Width ' supports minimum printing paper:
RET = devicecapabilities (printer name, "LPT1", Dc_minextent, ByVal 0&, ByVal 0&)
Length = ret \ 65536
Width = Ret-length * 65536
' Number of supported paper types
RET = devicecapabilities (printer name, "LPT1", Dc_papers, ByVal 0&, ByVal 0&) ' paper number
ReDim Paperno (1 to ret) as Integer
Call DeviceCapabilities (printer name, "LPT1", Dc_papers, Paperno (1), ByVal 0&) ' paper name
Dim Arrpagename () as Byte
Dim Allnames as String
Dim Lstart as Long, lEnd as Long
ReDim Papername (1 to ret) as String
ReDim Arrpagename (1 to RET *) as Byte
Call DeviceCapabilities (printer name, "LPT1", Dc_papernames, Arrpagename (1), ByVal 0&)
Allnames = StrConv (Arrpagename, Vbunicode)
' Loop through the string and search for the names of the papers
i = 1
Todo
LEnd = InStr (Lstart + 1, allnames, chr$ (0), Vbbinarycompare)
If (LEnd > 0) and (lend-lstart-1 > 0) Then
Papername (i) = mid$ (allnames, Lstart + 1, lend-lstart-1)
i = i + 1
End If
Lstart = LEnd
Loop Until lEnd = 0 ' paper size ReDim PaperSize (1 to ret) as POINTS
Call DeviceCapabilities (Form2.Combo1.Text, "LPT1", Dc_papersize, PAPERSIZE (1), ByVal 0&) ' Show in table
For i = 1 to ret
Fgd1. AddItem Paperno (i) & VbTab & Papername (i) & VbTab & PaperSize (i). Y & VbTab & PaperSize (i). x
Next i ' Remove the first empty line
Fgd1. Row = 1
Fgd1. RemoveItem 1
End SubPrivate Sub form_resize ()
With FGD1
. left = 0
. Width = Me.scalewidth
. Height = Me.scaleheight
. top = 0
End WithEnd Sub
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.