home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LVB
/
T2W32543.ZIP
/
_PRINTER.FRM
< prev
next >
Wrap
Text File
|
1998-05-21
|
14KB
|
398 lines
VERSION 5.00
Begin VB.Form frmPrinter
BorderStyle = 4 'Fixed ToolWindow
Caption = "Printer"
ClientHeight = 4845
ClientLeft = 1890
ClientTop = 3270
ClientWidth = 7485
MaxButton = 0 'False
MDIChild = -1 'True
PaletteMode = 1 'UseZOrder
ScaleHeight = 4845
ScaleWidth = 7485
ShowInTaskbar = 0 'False
Begin VB.Frame Frame1
Height = 570
Left = 0
TabIndex = 1
Top = -90
Width = 7485
Begin VB.CommandButton cmdNP
Caption = ">"
Height = 285
Index = 1
Left = 7110
TabIndex = 6
Top = 195
Width = 285
End
Begin VB.CommandButton cmdNP
Caption = "<"
Height = 285
Index = 0
Left = 6210
TabIndex = 5
Top = 195
Width = 285
End
Begin VB.CommandButton Command1
Caption = "&Go"
Default = -1 'True
Height = 285
Left = 6570
TabIndex = 4
Top = 195
Width = 465
End
Begin VB.ComboBox cmb_Function
Height = 315
Left = 1365
TabIndex = 2
Top = 180
Width = 4755
End
Begin VB.Label Label2
Caption = "&Select a function"
Height = 255
Left = 90
TabIndex = 3
Top = 210
Width = 1275
End
End
Begin VB.TextBox txt_Result
BackColor = &H00C0C0C0&
BorderStyle = 0 'None
Height = 4110
Left = 105
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 630
Width = 7260
End
End
Attribute VB_Name = "frmPrinter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Base 1
Private Const Iteration = 25
Dim IsLoaded As Integer
Dim TimerStartOk As Integer
Dim TimerCloseOk As Integer
Dim TimerHandle As Integer
Dim TimerValue As Long
Private Sub cmb_Function_Click()
If (IsLoaded = False) Then Exit Sub
Call cDisableFI(mdiT2W.Picture1)
txt_Result = ""
DoEvents
Select Case cmb_Function.ListIndex
Case 0
Call TestEnumPJ
Case 1
Call TestPrinterPrintableArea
Case 2
Call TestPrinterX
Case 3
Call TestEnumPrinters
End Select
DoEvents
Call cEnableFI(mdiT2W.Picture1)
End Sub
Private Sub cmdNP_Click(Index As Integer)
Call sub_NextPrev(cmb_Function, Index)
End Sub
Private Sub Form_Activate()
mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
End Sub
Private Sub Form_Load()
IsLoaded = False
Show
Call sub_Load_Combo(cmb_Function, T2WDirInst + "_printer.t2w")
IsLoaded = True
End Sub
Private Sub Command1_Click()
Call cmb_Function_Click
End Sub
Private Sub TestEnumPJ()
Dim intResult As Integer
Dim strDisplay As String
Dim i As Integer
strDisplay = ""
Dim JI As tagJOBINFO
intResult = cEnumPrinterJobs("LPT1:", JI, True)
Do While (intResult = EPJ_SUCCESS)
strDisplay = strDisplay + "sPrinterName : '" & JI.sPrinterName & "'" & vbCrLf
strDisplay = strDisplay + "sMachineName : '" & JI.sMachineName & "'" & vbCrLf
strDisplay = strDisplay + "sUserName : '" & JI.sUserName & "'" & vbCrLf
strDisplay = strDisplay + "sDocument : '" & JI.sDocument & "'" & vbCrLf
strDisplay = strDisplay + "lJobId : " & JI.lJobId & vbCrLf
strDisplay = strDisplay + "lStatus : " & JI.lStatus & vbCrLf
strDisplay = strDisplay + "lPriority : " & JI.lPriority & vbCrLf
strDisplay = strDisplay + "lPosition : " & JI.lPosition & vbCrLf
strDisplay = strDisplay + "lStartTime : " & JI.lStartTime & vbCrLf
strDisplay = strDisplay + "lUntilTime : " & JI.lUntilTime & vbCrLf
strDisplay = strDisplay + "lTotalPages : " & JI.lTotalPages & vbCrLf
strDisplay = strDisplay + "lPagesPrinted : " & JI.lPagesPrinted & vbCrLf
strDisplay = strDisplay + "lSize : " & JI.lSize & vbCrLf
strDisplay = strDisplay + "lTime : " & JI.lTime & vbCrLf
strDisplay = strDisplay + "Submitted : " & JI.wMonth & "/" & JI.wDay & "/" & JI.wYear & " " & JI.wHour & ":" & JI.wMinute & ":" & JI.wSecond & vbCrLf & vbCrLf
intResult = cEnumPrinterJobs("LPT1:", JI, False)
Loop
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cEnumPrinterJobs("LPT1:", JI, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestPrinterPrintableArea()
Dim intResult As Integer
Dim strDisplay As String
Dim sngResult As Single
Dim i As Integer
strDisplay = ""
strDisplay = strDisplay + "Printer width : " & cPrinterWidth(Printer.hDC) & vbCrLf
strDisplay = strDisplay + "Printer height : " & cPrinterHeight(Printer.hDC) & vbCrLf
strDisplay = strDisplay + "Printer offset left : " & cPrinterOffsetLeft(Printer.hDC) & vbCrLf
strDisplay = strDisplay + "Printer offset top : " & cPrinterOffsetTop(Printer.hDC) & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
sngResult = cPrinterWidth(Printer.hDC)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestPrinterX()
Dim intResult As Integer
Dim strDisplay As String
Dim sngResult As Single
Dim i As Integer
Dim iValue As Integer
Dim iCopies As Integer
Dim iDefaultSource As Integer
Dim iDitherType As Integer
Dim iOrientation As Integer
Dim iPaper As Integer
Dim iQuality As Integer
strDisplay = ""
strDisplay = strDisplay + "GetPrinter informations " & vbCrLf & vbCrLf
intResult = cGetPrinterCopies("LPT1:", iCopies)
strDisplay = strDisplay + " Copies = " & iCopies & vbCrLf
intResult = cGetPrinterDefaultSource("LPT1:", iDefaultSource)
strDisplay = strDisplay + " Default Source = " & iDefaultSource & vbCrLf
intResult = cGetPrinterDitherType("LPT1:", iDitherType)
strDisplay = strDisplay + " Dither Type = " & iDitherType & vbCrLf
intResult = cGetPrinterOrientation("LPT1:", iOrientation)
strDisplay = strDisplay + " Orientation = " & iOrientation & vbCrLf
intResult = cGetPrinterPaper("LPT1:", iPaper)
strDisplay = strDisplay + " Paper = " & iPaper & vbCrLf
intResult = cGetPrinterQuality("LPT1:", iQuality)
strDisplay = strDisplay + " Quality = " & iQuality & vbCrLf & vbCrLf
strDisplay = strDisplay + "SetPrinter informations " & vbCrLf & vbCrLf
intResult = cSetPrinterCopies("LPT1:", 7)
strDisplay = strDisplay + " Set Copies to 7 = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterDefaultSource("LPT1:", SP_SOURCE_LOWER)
strDisplay = strDisplay + " Set DefaultSource to SP_SOURCE_LOWER = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterDitherType("LPT1:", SP_DITHER_LINEART)
strDisplay = strDisplay + " Set DitherType to SP_DITHER_LINEART = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterOrientation("LPT1:", SP_ORIENTATION_LANDSCAPE)
strDisplay = strDisplay + " Set Orientation to SP_ORIENTATION_LANDSCAPE = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterQuality("LPT1:", SP_QUALITY_HIGH)
strDisplay = strDisplay + " Set Quality to SP_QUALITY_HIGH = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf & vbCrLf
strDisplay = strDisplay + "GetPrinter informations after modifications" & vbCrLf & vbCrLf
intResult = cGetPrinterCopies("LPT1:", iValue)
strDisplay = strDisplay + " Copies = " & iValue & vbCrLf
intResult = cGetPrinterDefaultSource("LPT1:", iValue)
strDisplay = strDisplay + " Default Source = " & iValue & vbCrLf
intResult = cGetPrinterDitherType("LPT1:", iValue)
strDisplay = strDisplay + " Dither Type = " & iValue & vbCrLf
intResult = cGetPrinterOrientation("LPT1:", iValue)
strDisplay = strDisplay + " Orientation = " & iValue & vbCrLf
intResult = cGetPrinterPaper("LPT1:", iValue)
strDisplay = strDisplay + " Paper = " & iValue & vbCrLf
intResult = cGetPrinterQuality("LPT1:", iValue)
strDisplay = strDisplay + " Quality = " & iValue & vbCrLf & vbCrLf
strDisplay = strDisplay + "Restore printer informations " & vbCrLf & vbCrLf
intResult = cSetPrinterCopies("LPT1:", iCopies)
strDisplay = strDisplay + " Set Copies to " & iCopies & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterDefaultSource("LPT1:", iDefaultSource)
strDisplay = strDisplay + " Set DefaultSource to " & iDefaultSource & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterDitherType("LPT1:", iDitherType)
strDisplay = strDisplay + " Set DitherType to " & iDitherType & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterOrientation("LPT1:", iOrientation)
strDisplay = strDisplay + " Set Orientation to " & iOrientation & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
intResult = cSetPrinterQuality("LPT1:", iQuality)
strDisplay = strDisplay + " Set Quality to " & iQuality & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf & vbCrLf
strDisplay = strDisplay + "Read again GetPrinter informations " & vbCrLf & vbCrLf
intResult = cGetPrinterCopies("LPT1:", iCopies)
strDisplay = strDisplay + " Copies = " & iCopies & vbCrLf
intResult = cGetPrinterDefaultSource("LPT1:", iDefaultSource)
strDisplay = strDisplay + " Default Source = " & iDefaultSource & vbCrLf
intResult = cGetPrinterDitherType("LPT1:", iDitherType)
strDisplay = strDisplay + " Dither Type = " & iDitherType & vbCrLf
intResult = cGetPrinterOrientation("LPT1:", iOrientation)
strDisplay = strDisplay + " Orientation = " & iOrientation & vbCrLf
intResult = cGetPrinterPaper("LPT1:", iPaper)
strDisplay = strDisplay + " Paper = " & iPaper & vbCrLf
intResult = cGetPrinterQuality("LPT1:", iQuality)
strDisplay = strDisplay + " Quality = " & iQuality & vbCrLf & vbCrLf
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cGetPrinterCopies("LPT1:", iValue)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub
Private Sub TestEnumPrinters()
Dim intResult As Integer
Dim strDisplay As String
Dim P1 As tagPRINTER1
Dim P2 As tagPRINTER2
Dim P5 As tagPRINTER5
Dim i As Integer
strDisplay = ""
strDisplay = strDisplay & "EnumPrinters1" & vbCrLf & vbCrLf
intResult = cEnumPrinters1(P1, True)
Do While (intResult = EP_SUCCESS)
strDisplay = strDisplay + "sPrinterName : '" & P1.sPrinterName & "'" & vbCrLf
strDisplay = strDisplay + "sDescription : '" & P1.sDescription & "'" & vbCrLf
strDisplay = strDisplay + "sComment : '" & P1.sComment & "'" & vbCrLf & vbCrLf
intResult = cEnumPrinters1(P1, False)
Loop
strDisplay = strDisplay + vbCrLf + "EnumPrinters5" & vbCrLf & vbCrLf
intResult = cEnumPrinters5(P5, True)
Do While (intResult = EP_SUCCESS)
strDisplay = strDisplay + "sPrinterName : '" & P5.sPrinterName & "'" & vbCrLf
strDisplay = strDisplay + "sPortName : '" & P5.sPortName & "'" & vbCrLf & vbCrLf
intResult = cEnumPrinters5(P5, False)
Loop
txt_Result = strDisplay
'time the function
TimerHandle = cTimerOpen()
TimerStartOk = cTimerStart(TimerHandle)
For i = 1 To Iteration
intResult = cEnumPrinters1(P1, True)
Next i
mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
TimerCloseOk = cTimerClose(TimerHandle)
End Sub