home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 35 / hot35.iso / ficheros / LVB / T2W32534.ZIP / _PRINTER.FRM < prev    next >
Text File  |  1998-05-02  |  16KB  |  465 lines

  1. VERSION 5.00
  2. Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
  3. Begin VB.Form frmPrinter 
  4.    BorderStyle     =   4  'Fixed ToolWindow
  5.    Caption         =   "Printer"
  6.    ClientHeight    =   4845
  7.    ClientLeft      =   1890
  8.    ClientTop       =   3270
  9.    ClientWidth     =   7485
  10.    MaxButton       =   0   'False
  11.    MDIChild        =   -1  'True
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   4845
  14.    ScaleWidth      =   7485
  15.    ShowInTaskbar   =   0   'False
  16.    Begin VB.TextBox txt_Result 
  17.       BackColor       =   &H00C0C0C0&
  18.       BorderStyle     =   0  'None
  19.       Height          =   4110
  20.       Left            =   105
  21.       Locked          =   -1  'True
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   0
  25.       Top             =   630
  26.       Width           =   7260
  27.    End
  28.    Begin Threed.SSPanel SSPanel1 
  29.       Align           =   1  'Align Top
  30.       Height          =   480
  31.       Left            =   0
  32.       TabIndex        =   1
  33.       Top             =   0
  34.       Width           =   7485
  35.       _Version        =   65536
  36.       _ExtentX        =   13203
  37.       _ExtentY        =   847
  38.       _StockProps     =   15
  39.       ForeColor       =   -2147483640
  40.       BackColor       =   12632256
  41.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  42.          Name            =   "MS Sans Serif"
  43.          Size            =   8.25
  44.          Charset         =   0
  45.          Weight          =   400
  46.          Underline       =   0   'False
  47.          Italic          =   0   'False
  48.          Strikethrough   =   0   'False
  49.       EndProperty
  50.       Begin VB.ComboBox cmb_Function 
  51.          Height          =   315
  52.          Left            =   1365
  53.          TabIndex        =   2
  54.          Top             =   90
  55.          Width           =   4785
  56.       End
  57.       Begin Threed.SSCommand cmdNP 
  58.          Height          =   300
  59.          Index           =   1
  60.          Left            =   7140
  61.          TabIndex        =   6
  62.          Top             =   90
  63.          Width           =   255
  64.          _Version        =   65536
  65.          _ExtentX        =   450
  66.          _ExtentY        =   529
  67.          _StockProps     =   78
  68.          Caption         =   ">"
  69.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  70.             Name            =   "MS Sans Serif"
  71.             Size            =   8.25
  72.             Charset         =   0
  73.             Weight          =   400
  74.             Underline       =   0   'False
  75.             Italic          =   0   'False
  76.             Strikethrough   =   0   'False
  77.          EndProperty
  78.          BevelWidth      =   1
  79.          Font3D          =   3
  80.          RoundedCorners  =   0   'False
  81.          Outline         =   0   'False
  82.       End
  83.       Begin Threed.SSCommand cmdNP 
  84.          Height          =   300
  85.          Index           =   0
  86.          Left            =   6300
  87.          TabIndex        =   5
  88.          Top             =   90
  89.          Width           =   255
  90.          _Version        =   65536
  91.          _ExtentX        =   450
  92.          _ExtentY        =   529
  93.          _StockProps     =   78
  94.          Caption         =   "<"
  95.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  96.             Name            =   "MS Sans Serif"
  97.             Size            =   8.25
  98.             Charset         =   0
  99.             Weight          =   400
  100.             Underline       =   0   'False
  101.             Italic          =   0   'False
  102.             Strikethrough   =   0   'False
  103.          EndProperty
  104.          BevelWidth      =   1
  105.          Font3D          =   3
  106.          RoundedCorners  =   0   'False
  107.          Outline         =   0   'False
  108.       End
  109.       Begin Threed.SSCommand SSCommand1 
  110.          Default         =   -1  'True
  111.          Height          =   300
  112.          Left            =   6615
  113.          TabIndex        =   3
  114.          Top             =   90
  115.          Width           =   465
  116.          _Version        =   65536
  117.          _ExtentX        =   820
  118.          _ExtentY        =   529
  119.          _StockProps     =   78
  120.          Caption         =   "&Go"
  121.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  122.             Name            =   "MS Sans Serif"
  123.             Size            =   8.25
  124.             Charset         =   0
  125.             Weight          =   400
  126.             Underline       =   0   'False
  127.             Italic          =   0   'False
  128.             Strikethrough   =   0   'False
  129.          EndProperty
  130.          BevelWidth      =   1
  131.          RoundedCorners  =   0   'False
  132.          Outline         =   0   'False
  133.       End
  134.       Begin VB.Label Label2 
  135.          Caption         =   "&Select a function"
  136.          Height          =   255
  137.          Left            =   90
  138.          TabIndex        =   4
  139.          Top             =   120
  140.          Width           =   1275
  141.       End
  142.    End
  143. End
  144. Attribute VB_Name = "frmPrinter"
  145. Attribute VB_GlobalNameSpace = False
  146. Attribute VB_Creatable = False
  147. Attribute VB_PredeclaredId = True
  148. Attribute VB_Exposed = False
  149. Option Explicit
  150. Option Base 1
  151.  
  152. Private Const Iteration = 25
  153.  
  154. Dim IsLoaded         As Integer
  155.  
  156. Dim TimerStartOk     As Integer
  157. Dim TimerCloseOk     As Integer
  158.  
  159. Dim TimerHandle      As Integer
  160. Dim TimerValue       As Long
  161.  
  162. Private Sub cmb_Function_Click()
  163.    
  164.    If (IsLoaded = False) Then Exit Sub
  165.    
  166.    Call cDisableFI(mdiT2W.Picture1)
  167.    
  168.    txt_Result = ""
  169.    
  170.    DoEvents
  171.    
  172.    Select Case cmb_Function.ListIndex
  173.       Case 0
  174.          Call TestEnumPJ
  175.       Case 1
  176.          Call TestPrinterPrintableArea
  177.       Case 2
  178.          Call TestPrinterX
  179.       Case 3
  180.          Call TestEnumPrinters
  181.    End Select
  182.  
  183.    DoEvents
  184.    Call cEnableFI(mdiT2W.Picture1)
  185.    
  186. End Sub
  187.  
  188.  
  189. Private Sub cmdNP_Click(Index As Integer)
  190.  
  191.    Call sub_NextPrev(cmb_Function, Index)
  192.  
  193. End Sub
  194.  
  195. Private Sub Form_Activate()
  196.  
  197.    mdiT2W.Label2.Caption = cInsertBlocks(mdiT2W.Label2.Tag, "" & Iteration)
  198.  
  199. End Sub
  200.  
  201. Private Sub Form_Load()
  202.  
  203.    IsLoaded = False
  204.    
  205.    Show
  206.  
  207.    Call sub_Load_Combo(cmb_Function, T2WDirInst + "_printer.t2w")
  208.    
  209.    IsLoaded = True
  210.    
  211. End Sub
  212.  
  213. Private Sub SSCommand1_Click()
  214.    
  215.    Call cmb_Function_Click
  216.    
  217. End Sub
  218.  
  219. Private Sub TestEnumPJ()
  220.  
  221.    Dim intResult        As Integer
  222.    Dim strDisplay       As String
  223.    
  224.    Dim i                As Integer
  225.    
  226.    strDisplay = ""
  227.    
  228.    Dim JI               As tagJOBINFO
  229.    
  230.    intResult = cEnumPrinterJobs("LPT1:", JI, True)
  231.    
  232.    Do While (intResult = EPJ_SUCCESS)
  233.    
  234.       strDisplay = strDisplay + "sPrinterName : '" & JI.sPrinterName & "'" & vbCrLf
  235.       strDisplay = strDisplay + "sMachineName : '" & JI.sMachineName & "'" & vbCrLf
  236.       strDisplay = strDisplay + "sUserName : '" & JI.sUserName & "'" & vbCrLf
  237.       strDisplay = strDisplay + "sDocument : '" & JI.sDocument & "'" & vbCrLf
  238.       strDisplay = strDisplay + "lJobId : " & JI.lJobId & vbCrLf
  239.       strDisplay = strDisplay + "lStatus : " & JI.lStatus & vbCrLf
  240.       strDisplay = strDisplay + "lPriority : " & JI.lPriority & vbCrLf
  241.       strDisplay = strDisplay + "lPosition : " & JI.lPosition & vbCrLf
  242.       strDisplay = strDisplay + "lStartTime : " & JI.lStartTime & vbCrLf
  243.       strDisplay = strDisplay + "lUntilTime : " & JI.lUntilTime & vbCrLf
  244.       strDisplay = strDisplay + "lTotalPages : " & JI.lTotalPages & vbCrLf
  245.       strDisplay = strDisplay + "lPagesPrinted : " & JI.lPagesPrinted & vbCrLf
  246.       strDisplay = strDisplay + "lSize : " & JI.lSize & vbCrLf
  247.       strDisplay = strDisplay + "lTime : " & JI.lTime & vbCrLf
  248.       strDisplay = strDisplay + "Submitted : " & JI.wMonth & "/" & JI.wDay & "/" & JI.wYear & " " & JI.wHour & ":" & JI.wMinute & ":" & JI.wSecond & vbCrLf & vbCrLf
  249.       
  250.       intResult = cEnumPrinterJobs("LPT1:", JI, False)
  251.    
  252.    Loop
  253.    
  254.    txt_Result = strDisplay
  255.  
  256.    'time the function
  257.  
  258.    TimerHandle = cTimerOpen()
  259.    TimerStartOk = cTimerStart(TimerHandle)
  260.    
  261.    For i = 1 To Iteration
  262.       intResult = cEnumPrinterJobs("LPT1:", JI, True)
  263.    Next i
  264.    
  265.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  266.    
  267.    TimerCloseOk = cTimerClose(TimerHandle)
  268.    
  269. End Sub
  270.  
  271. Private Sub TestPrinterPrintableArea()
  272.  
  273.    Dim intResult        As Integer
  274.    Dim strDisplay       As String
  275.    Dim sngResult        As Single
  276.    
  277.    Dim i                As Integer
  278.    
  279.    strDisplay = ""
  280.    
  281.    strDisplay = strDisplay + "Printer width : " & cPrinterWidth(Printer.hDC) & vbCrLf
  282.    strDisplay = strDisplay + "Printer height : " & cPrinterHeight(Printer.hDC) & vbCrLf
  283.    strDisplay = strDisplay + "Printer offset left : " & cPrinterOffsetLeft(Printer.hDC) & vbCrLf
  284.    strDisplay = strDisplay + "Printer offset top : " & cPrinterOffsetTop(Printer.hDC) & vbCrLf
  285.    
  286.    txt_Result = strDisplay
  287.  
  288.    'time the function
  289.  
  290.    TimerHandle = cTimerOpen()
  291.    TimerStartOk = cTimerStart(TimerHandle)
  292.    
  293.    For i = 1 To Iteration
  294.       sngResult = cPrinterWidth(Printer.hDC)
  295.    Next i
  296.    
  297.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  298.    
  299.    TimerCloseOk = cTimerClose(TimerHandle)
  300.    
  301. End Sub
  302.  
  303. Private Sub TestPrinterX()
  304.  
  305.    Dim intResult        As Integer
  306.    Dim strDisplay       As String
  307.    Dim sngResult        As Single
  308.    
  309.    Dim i                As Integer
  310.    Dim iValue           As Integer
  311.    
  312.    Dim iCopies          As Integer
  313.    Dim iDefaultSource   As Integer
  314.    Dim iDitherType      As Integer
  315.    Dim iOrientation     As Integer
  316.    Dim iPaper           As Integer
  317.    Dim iQuality         As Integer
  318.    
  319.    strDisplay = ""
  320.    
  321.    strDisplay = strDisplay + "GetPrinter informations " & vbCrLf & vbCrLf
  322.    
  323.    intResult = cGetPrinterCopies("LPT1:", iCopies)
  324.    strDisplay = strDisplay + "   Copies = " & iCopies & vbCrLf
  325.    intResult = cGetPrinterDefaultSource("LPT1:", iDefaultSource)
  326.    strDisplay = strDisplay + "   Default Source = " & iDefaultSource & vbCrLf
  327.    intResult = cGetPrinterDitherType("LPT1:", iDitherType)
  328.    strDisplay = strDisplay + "   Dither Type = " & iDitherType & vbCrLf
  329.    intResult = cGetPrinterOrientation("LPT1:", iOrientation)
  330.    strDisplay = strDisplay + "   Orientation = " & iOrientation & vbCrLf
  331.    intResult = cGetPrinterPaper("LPT1:", iPaper)
  332.    strDisplay = strDisplay + "   Paper = " & iPaper & vbCrLf
  333.    intResult = cGetPrinterQuality("LPT1:", iQuality)
  334.    strDisplay = strDisplay + "   Quality = " & iQuality & vbCrLf & vbCrLf
  335.    
  336.    strDisplay = strDisplay + "SetPrinter informations " & vbCrLf & vbCrLf
  337.    
  338.    intResult = cSetPrinterCopies("LPT1:", 7)
  339.    strDisplay = strDisplay + "   Set Copies to 7 = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  340.    intResult = cSetPrinterDefaultSource("LPT1:", SP_SOURCE_LOWER)
  341.    strDisplay = strDisplay + "   Set DefaultSource to SP_SOURCE_LOWER = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  342.    intResult = cSetPrinterDitherType("LPT1:", SP_DITHER_LINEART)
  343.    strDisplay = strDisplay + "   Set DitherType to SP_DITHER_LINEART = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  344.    intResult = cSetPrinterOrientation("LPT1:", SP_ORIENTATION_LANDSCAPE)
  345.    strDisplay = strDisplay + "   Set Orientation to SP_ORIENTATION_LANDSCAPE = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  346.    intResult = cSetPrinterQuality("LPT1:", SP_QUALITY_HIGH)
  347.    strDisplay = strDisplay + "   Set Quality to SP_QUALITY_HIGH = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf & vbCrLf
  348.    
  349.    strDisplay = strDisplay + "GetPrinter informations after modifications" & vbCrLf & vbCrLf
  350.    
  351.    intResult = cGetPrinterCopies("LPT1:", iValue)
  352.    strDisplay = strDisplay + "   Copies = " & iValue & vbCrLf
  353.    intResult = cGetPrinterDefaultSource("LPT1:", iValue)
  354.    strDisplay = strDisplay + "   Default Source = " & iValue & vbCrLf
  355.    intResult = cGetPrinterDitherType("LPT1:", iValue)
  356.    strDisplay = strDisplay + "   Dither Type = " & iValue & vbCrLf
  357.    intResult = cGetPrinterOrientation("LPT1:", iValue)
  358.    strDisplay = strDisplay + "   Orientation = " & iValue & vbCrLf
  359.    intResult = cGetPrinterPaper("LPT1:", iValue)
  360.    strDisplay = strDisplay + "   Paper = " & iValue & vbCrLf
  361.    intResult = cGetPrinterQuality("LPT1:", iValue)
  362.    strDisplay = strDisplay + "   Quality = " & iValue & vbCrLf & vbCrLf
  363.    
  364.    strDisplay = strDisplay + "Restore printer informations " & vbCrLf & vbCrLf
  365.    
  366.    intResult = cSetPrinterCopies("LPT1:", iCopies)
  367.    strDisplay = strDisplay + "   Set Copies to " & iCopies & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  368.    intResult = cSetPrinterDefaultSource("LPT1:", iDefaultSource)
  369.    strDisplay = strDisplay + "   Set DefaultSource to " & iDefaultSource & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  370.    intResult = cSetPrinterDitherType("LPT1:", iDitherType)
  371.    strDisplay = strDisplay + "   Set DitherType to " & iDitherType & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  372.    intResult = cSetPrinterOrientation("LPT1:", iOrientation)
  373.    strDisplay = strDisplay + "   Set Orientation to " & iOrientation & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf
  374.    intResult = cSetPrinterQuality("LPT1:", iQuality)
  375.    strDisplay = strDisplay + "   Set Quality to " & iQuality & " = " & IIf(intResult = SP_SUCCESS, "ok", "ko") & vbCrLf & vbCrLf
  376.    
  377.    strDisplay = strDisplay + "Read again GetPrinter informations " & vbCrLf & vbCrLf
  378.    
  379.    intResult = cGetPrinterCopies("LPT1:", iCopies)
  380.    strDisplay = strDisplay + "   Copies = " & iCopies & vbCrLf
  381.    intResult = cGetPrinterDefaultSource("LPT1:", iDefaultSource)
  382.    strDisplay = strDisplay + "   Default Source = " & iDefaultSource & vbCrLf
  383.    intResult = cGetPrinterDitherType("LPT1:", iDitherType)
  384.    strDisplay = strDisplay + "   Dither Type = " & iDitherType & vbCrLf
  385.    intResult = cGetPrinterOrientation("LPT1:", iOrientation)
  386.    strDisplay = strDisplay + "   Orientation = " & iOrientation & vbCrLf
  387.    intResult = cGetPrinterPaper("LPT1:", iPaper)
  388.    strDisplay = strDisplay + "   Paper = " & iPaper & vbCrLf
  389.    intResult = cGetPrinterQuality("LPT1:", iQuality)
  390.    strDisplay = strDisplay + "   Quality = " & iQuality & vbCrLf & vbCrLf
  391.    
  392.    txt_Result = strDisplay
  393.  
  394.    'time the function
  395.  
  396.    TimerHandle = cTimerOpen()
  397.    TimerStartOk = cTimerStart(TimerHandle)
  398.    
  399.    For i = 1 To Iteration
  400.       intResult = cGetPrinterCopies("LPT1:", iValue)
  401.    Next i
  402.    
  403.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  404.    
  405.    TimerCloseOk = cTimerClose(TimerHandle)
  406.    
  407. End Sub
  408.  
  409. Private Sub TestEnumPrinters()
  410.  
  411.    Dim intResult        As Integer
  412.    Dim strDisplay       As String
  413.    Dim P1               As tagPRINTER1
  414.    Dim P2               As tagPRINTER2
  415.    Dim P5               As tagPRINTER5
  416.    
  417.    Dim i                As Integer
  418.    
  419.    strDisplay = ""
  420.    
  421.    strDisplay = strDisplay & "EnumPrinters1" & vbCrLf & vbCrLf
  422.    
  423.    intResult = cEnumPrinters1(P1, True)
  424.    
  425.    Do While (intResult = EP_SUCCESS)
  426.    
  427.       strDisplay = strDisplay + "sPrinterName : '" & P1.sPrinterName & "'" & vbCrLf
  428.       strDisplay = strDisplay + "sDescription : '" & P1.sDescription & "'" & vbCrLf
  429.       strDisplay = strDisplay + "sComment : '" & P1.sComment & "'" & vbCrLf & vbCrLf
  430.       
  431.       intResult = cEnumPrinters1(P1, False)
  432.    
  433.    Loop
  434.    
  435.    strDisplay = strDisplay + vbCrLf + "EnumPrinters5" & vbCrLf & vbCrLf
  436.    
  437.    intResult = cEnumPrinters5(P5, True)
  438.    
  439.    Do While (intResult = EP_SUCCESS)
  440.    
  441.       strDisplay = strDisplay + "sPrinterName : '" & P5.sPrinterName & "'" & vbCrLf
  442.       strDisplay = strDisplay + "sPortName : '" & P5.sPortName & "'" & vbCrLf & vbCrLf
  443.       
  444.       intResult = cEnumPrinters5(P5, False)
  445.    
  446.    Loop
  447.    
  448.    txt_Result = strDisplay
  449.  
  450.    'time the function
  451.  
  452.    TimerHandle = cTimerOpen()
  453.    TimerStartOk = cTimerStart(TimerHandle)
  454.    
  455.    For i = 1 To Iteration
  456.       intResult = cEnumPrinters1(P1, True)
  457.    Next i
  458.    
  459.    mdiT2W.pnl_Timer = cTimerRead(TimerHandle)
  460.    
  461.    TimerCloseOk = cTimerClose(TimerHandle)
  462.    
  463. End Sub
  464.  
  465.