home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / p_print / pprtrfrm.txt < prev    next >
Text File  |  1994-07-07  |  16KB  |  509 lines

  1. Declare Function PPrtr Lib "PPRTR.DLL" (ByVal hWnd As Integer, ByVal ppSelection As Integer, ByVal PPNewValue As Integer, ByVal ppAction As Integer) As Integer
  2. Declare Function DefPrtr Lib "PPRTR.DLL" (ByVal newone As String, ByVal oldone As String) As Integer
  3. Declare Function Prtrs Lib "PPRTR.DLL" (ByVal plist As String) As Integer
  4. Declare Function PrtrCap Lib "PPRTR.DLL" (ndc As DEVCAP) As Integer
  5. Declare Function GetPrtr Lib "PPRTR.DLL" (ByVal DefPrtr As String) As Integer
  6. Declare Function GetPort Lib "PPRTR.DLL" (ByVal ptrport As String) As Integer
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. Sub CLIPCAPS ()
  14.     If dc.CLIPCAPS = CP_NONE Then
  15.         list2.AddItem "CLIPCAPS:  None "
  16.         Exit Sub
  17.     Else
  18.         list2.AddItem "CLIPCAPS"
  19.     End If
  20.     If dc.CLIPCAPS And CP_RECTANGLE Then
  21.         list2.AddItem "  Output clipped to rectangles:  Yes"
  22.     Else
  23.         list2.AddItem "  Output clipped to rectangles:  No"
  24.     End If
  25.     If dc.CLIPCAPS And LC_REGION Then
  26.         list2.AddItem "  Output clipped to regions:  Yes"
  27.     Else
  28.         list2.AddItem "  Output clipped to regions:  No"
  29.     End If
  30. End Sub
  31.  
  32. Sub Command1_Click ()
  33.     MsgBox "Pagesize is: " + Str$(PPrtr(hWnd, DM_PAPERSIZE, PP_UNNEEDED, PP_GIMME)), 0, "PaperSize"
  34. End Sub
  35.  
  36. Sub Command10_Click ()
  37.     MsgBox "Quality is: " + Str$(PPrtr(hWnd, DM_PRINTQUALITY, PP_UNNEEDED, PP_GIMME)), 0, "PrintQuality"
  38. End Sub
  39.  
  40. Sub Command11_Click ()
  41.     plist$ = String$(255, 0)
  42.     i = Prtrs(plist$)
  43. '    MsgBox Str$(i), 0, "size of returned string"
  44.  '   MsgBox plist$, 0, "returned string"
  45.     While i <> 0
  46.         j = InStr(plist$, ";")
  47.         If j = 0 Then
  48.            j = i + 1        ' no equiv of max() ??
  49.         End If
  50.         list1.AddItem Mid(plist$, 1, j - 1)
  51.         plist$ = Mid(plist$, j + 1)
  52.         i = Len(plist$)
  53.     Wend
  54. End Sub
  55.  
  56. Sub Command12_Click ()
  57.  
  58.     i = PrtrCap(dc) ' check for error
  59.     If i > 0 Then
  60.        MsgBox Str$(i)
  61.        Exit Sub
  62.     End If
  63.     list2.Clear
  64.     list2.AddItem "DRIVERVERSION: " + Str$(dc.DRIVERVERSION)
  65.     list2.AddItem "TECHNOLOGY: " + tech(dc.technology)    ' bits"
  66.     list2.AddItem "HORZSIZE: " + Str$(dc.HORZSIZE)
  67.     list2.AddItem "VERTSIZE: " + Str$(dc.VERTSIZE)
  68.     list2.AddItem "HORZRES: " + Str$(dc.HORZRES)
  69.     list2.AddItem "VERTRES: " + Str$(dc.VERTRES)
  70.     list2.AddItem "BITSPIXEL: " + Str$(dc.BITSPIXEL)
  71.     list2.AddItem "PLANES: " + Str$(dc.PLANES)
  72.     list2.AddItem "NUMBRUSHES: " + Str$(dc.NUMBRUSHES)
  73.     list2.AddItem "NUMPENS: " + Str$(dc.NUMPENS)
  74.     list2.AddItem "NUMMARKERS: " + Str$(dc.NUMMARKERS)
  75.     list2.AddItem "NUMFONTS: " + Str$(dc.NUMFONTS)
  76.     list2.AddItem "NUMCOLORS: " + Str$(dc.NUMCOLORS)
  77.     list2.AddItem "PDEVICESIZE: " + Str$(dc.PDEVICESIZE)
  78.     curve
  79.     LINECAPS
  80.     POLYGONAL
  81.     txt
  82.     CLIPCAPS
  83.     raster
  84.     list2.AddItem "ASPECTX: " + Str$(dc.ASPECTX)
  85.     list2.AddItem "ASPECTY: " + Str$(dc.ASPECTY)
  86.     list2.AddItem "ASPECTXY: " + Str$(dc.ASPECTXY)
  87.     list2.AddItem "LOGPIXELSX: " + Str$(dc.LOGPIXELSX)
  88.     list2.AddItem "LOGPIXELSY: " + Str$(dc.LOGPIXELSY)
  89.     list2.AddItem "SIZEPALETTE: " + Str$(dc.SIZEPALETTE)
  90.     list2.AddItem "NUMRESERVED: " + Str$(dc.NUMRESERVED)
  91.     list2.AddItem "COLORRES: " + Str$(dc.COLORRES)
  92.  
  93. End Sub
  94.  
  95. Sub Command13_Click ()
  96.     MsgBox "Orientation was: " + Str$(PPrtr(hWnd, DM_ORIENTATION, DMORIENT_LANDSCAPE, PP_CHANGE_IT)), 0, "Orientation"
  97. End Sub
  98.  
  99. Sub Command2_Click ()
  100.     MsgBox "Orientation was: " + Str$(PPrtr(hWnd, DM_ORIENTATION, DMORIENT_PORTRAIT, PP_CHANGE_IT)), 0, "Orientation"
  101. End Sub
  102.  
  103. Sub Command3_Click ()
  104.     MsgBox "Papersize was: " + Str$(PPrtr(hWnd, DM_PAPERSIZE, DMPAPER_LEGAL, PP_CHANGE_IT)), 0, "PaperSize"
  105. End Sub
  106.  
  107. Sub Command4_Click ()
  108.     MsgBox "Orientation is: " + Str$(PPrtr(hWnd, DM_ORIENTATION, PP_UNNEEDED, PP_GIMME)), 0, "Orientation"
  109. End Sub
  110.  
  111. Sub Command5_Click ()
  112.     oldprinter$ = String$(255, 0)
  113.     i = DefPrtr("Epson LX-800 on LPT1:", oldprinter$)
  114.     getdefault
  115.     MsgBox "return code = " + Str$(i)
  116.     MsgBox "old printer = " + oldprinter$
  117. End Sub
  118.  
  119. Sub Command6_Click ()
  120.     oldprinter$ = String$(255, 0)
  121.     i = DefPrtr("HP LaserJet Series II on LPT1:", oldprinter$)
  122.     getdefault
  123.     MsgBox "return code = " + Str$(i)
  124.     MsgBox "old printer = " + oldprinter$
  125. End Sub
  126.  
  127. Sub Command7_Click ()
  128.     ptrport$ = String$(255, 0)
  129.     i = GetPort(ptrport$)
  130.     If i > 0 Then
  131.        MsgBox "No Default Printer"
  132.     End If
  133.  
  134.     label9.Caption = ptrport$
  135. End Sub
  136.  
  137. Sub Command8_Click ()
  138.     MsgBox "Quality was: " + Str$(PPrtr(hWnd, DM_PRINTQUALITY, DMRES_DRAFT, PP_CHANGE_IT)), 0, "PrintQuality"
  139. End Sub
  140.  
  141. Sub Command9_Click ()
  142.     MsgBox "Quality was: " + Str$(PPrtr(hWnd, DM_PRINTQUALITY, DMRES_HIGH, PP_CHANGE_IT)), 0, "PrintQuality"
  143. End Sub
  144.  
  145. Sub curve ()
  146.     If dc.curvecaps = CC_NONE Then
  147.         list2.AddItem "CURVECAPS:  None "
  148.         Exit Sub
  149.     Else
  150.         list2.AddItem "CURVECAPS"
  151.     End If
  152.     If dc.curvecaps And CC_CIRCLES Then
  153.         list2.AddItem "  Circles:  Yes"
  154.     Else
  155.         list2.AddItem "  Circles:  No"
  156.     End If
  157.     If dc.curvecaps And CC_PIE Then
  158.         list2.AddItem "  Pie:  Yes"
  159.     Else
  160.         list2.AddItem "  Pie:  No"
  161.     End If
  162.     If dc.curvecaps And CC_CHORD Then
  163.         list2.AddItem "  Chord:  Yes"
  164.     Else
  165.         list2.AddItem "  Chord:  No"
  166.     End If
  167.     If dc.curvecaps And CC_ELLIPSES Then
  168.         list2.AddItem "  Ellipses:  Yes"
  169.     Else
  170.         list2.AddItem "  Ellipses:  No"
  171.     End If
  172.     If dc.curvecaps And CC_WIDE Then
  173.         list2.AddItem "  Wide:  Yes"
  174.     Else
  175.         list2.AddItem "  Wide:  No"
  176.     End If
  177.     If dc.curvecaps And CC_STYLED Then
  178.         list2.AddItem "  Styled:  Yes"
  179.     Else
  180.         list2.AddItem "  Styled:  No"
  181.     End If
  182.     If dc.curvecaps And CC_WIDESTYLED Then
  183.         list2.AddItem "  Widestyled:  Yes"
  184.     Else
  185.         list2.AddItem "  Widestyled:  No"
  186.     End If
  187.     If dc.curvecaps And CC_INTERIORS Then
  188.         list2.AddItem "  Interiors:  Yes"
  189.     Else
  190.         list2.AddItem "  Interiors:  No"
  191.     End If
  192.     If dc.curvecaps And CC_ROUNDRECT Then
  193.         list2.AddItem "  RoundRect:  Yes"
  194.     Else
  195.         list2.AddItem "  RoundRect:  No"
  196.     End If
  197. End Sub
  198.  
  199. Sub Form_Load ()
  200.     getdefault
  201. End Sub
  202.  
  203. Sub getdefault ()
  204.     defprinter$ = String$(255, 0)
  205.     i = GetPrtr(defprinter$)
  206.     If i > 0 Then
  207.        If i = 995 Then
  208.           MsgBox "There is no default printer -- sample ended"
  209.        Else
  210.           MsgBox "An error occured communicating with the printer driver -- sample ended"
  211.        End If
  212.        End
  213.     End If
  214.     
  215.     If label8.Caption <> defprinter$ Then
  216.         label8.Caption = defprinter$
  217.         list2.Clear
  218.     End If
  219. End Sub
  220.  
  221. Sub LINECAPS ()
  222.     If dc.LINECAPS = PC_NONE Then
  223.         list2.AddItem "LINECAPS:  None "
  224.         Exit Sub
  225.     Else
  226.         list2.AddItem "LINECAPS"
  227.     End If
  228.     If dc.LINECAPS And LC_POLYLINE Then
  229.         list2.AddItem "  Polylines:  Yes"
  230.     Else
  231.         list2.AddItem "  Polylines:  No"
  232.     End If
  233.     If dc.LINECAPS And LC_MARKER Then
  234.         list2.AddItem "  Markers:  Yes"
  235.     Else
  236.         list2.AddItem "  Markers:  No"
  237.     End If
  238.     If dc.LINECAPS And LC_POLYMARKER Then
  239.         list2.AddItem "  PolyMarkers:  Yes"
  240.     Else
  241.         list2.AddItem "  PolyMarkers:  No"
  242.     End If
  243.     If dc.LINECAPS And LC_WIDE Then
  244.         list2.AddItem "  Wide lines:  Yes"
  245.     Else
  246.         list2.AddItem "  Wide lines:  No"
  247.     End If
  248.     If dc.LINECAPS And LC_STYLED Then
  249.         list2.AddItem "  Styled lines:  Yes"
  250.     Else
  251.         list2.AddItem "  Styled lines:  No"
  252.     End If
  253.     If dc.LINECAPS And LC_WIDESTYLED Then
  254.         list2.AddItem "  Wide and styled lines:  Yes"
  255.     Else
  256.         list2.AddItem "  Wide and styled lines:  No"
  257.     End If
  258.     If dc.LINECAPS And LC_INTERIORS Then
  259.         list2.AddItem "  Interiors:  Yes"
  260.     Else
  261.         list2.AddItem "  Interiors:  No"
  262.     End If
  263. End Sub
  264.  
  265. Sub POLYGONAL ()
  266.     If dc.POLYGONALCAPS = PC_NONE Then
  267.         list2.AddItem "POLYGONALCAPS:  None "
  268.         Exit Sub
  269.     Else
  270.         list2.AddItem "POLYGONALCAPS"
  271.     End If
  272.     If dc.POLYGONALCAPS And PC_POLYGON Then
  273.         list2.AddItem "  Alternate fill polygons:  Yes"
  274.     Else
  275.         list2.AddItem "  Alternate fill polygons:  No"
  276.     End If
  277.     If dc.POLYGONALCAPS And PC_RECTANGLE Then
  278.         list2.AddItem "  Rectangle:  Yes"
  279.     Else
  280.         list2.AddItem "  Rectangle:  No"
  281.     End If
  282.     If dc.POLYGONALCAPS And PC_WINDPOLYGON Then
  283.         list2.AddItem "  Winding number fill polygon:  Yes"
  284.     Else
  285.         list2.AddItem "  Winding number fill polygon:  No"
  286.     End If
  287.     If dc.POLYGONALCAPS And PC_SCANLINE Then
  288.         list2.AddItem "  Scanlines:  Yes"
  289.     Else
  290.         list2.AddItem "  Scanlines:  No"
  291.     End If
  292.     If dc.POLYGONALCAPS And PC_WIDE Then
  293.         list2.AddItem "  Wide borders:  Yes"
  294.     Else
  295.         list2.AddItem "  Wide borders:  No"
  296.     End If
  297.     If dc.POLYGONALCAPS And PC_STYLED Then
  298.         list2.AddItem "  Styled borders:  Yes"
  299.     Else
  300.         list2.AddItem "  Styled borders:  No"
  301.     End If
  302.     If dc.POLYGONALCAPS And PC_WIDESTYLED Then
  303.         list2.AddItem "  Wide and styled borders:  Yes"
  304.     Else
  305.         list2.AddItem "  Wide and styled borders:  No"
  306.     End If
  307.     If dc.POLYGONALCAPS And PC_INTERIORS Then
  308.         list2.AddItem "  Interiors:  Yes"
  309.     Else
  310.         list2.AddItem "  Interiors:  No"
  311.     End If
  312. End Sub
  313.  
  314. Sub raster ()
  315.     If dc.RASTERCAPS = RC_NONE Then
  316.         list2.AddItem "RASTERCAPS:  None "
  317.         Exit Sub
  318.     Else
  319.         list2.AddItem "RASTERCAPS"
  320.     End If
  321.     If dc.RASTERCAPS And RC_BITBLT Then
  322.         list2.AddItem "  Capable of simple BitBlt:  Yes"
  323.     Else
  324.         list2.AddItem "  Capable of simple BitBlt:  No"
  325.     End If
  326.     If dc.RASTERCAPS And RC_BANDING Then
  327.         list2.AddItem "  Requires banding support:  Yes"
  328.     Else
  329.         list2.AddItem "  Requires banding support:  No"
  330.     End If
  331.     If dc.RASTERCAPS And RC_SCALING Then
  332.         list2.AddItem "  Requires scaling support:  Yes"
  333.     Else
  334.         list2.AddItem "  Requires scaling support:  No"
  335.     End If
  336.     If dc.RASTERCAPS And RC_BITMAP64 Then
  337.         list2.AddItem "  Supports bitmaps >64K:  Yes"
  338.     Else
  339.         list2.AddItem "  Supports bitmaps >64K:  No"
  340.     End If
  341.     If dc.RASTERCAPS And RC_GDI20_OUTPUT Then
  342.         list2.AddItem "  Has 2.0 output calls:  Yes"
  343.     Else
  344.         list2.AddItem "  Has Win 2.0 output calls:  No"
  345.     End If
  346.     If dc.RASTERCAPS And RC_GDI20_STATE Then
  347.         list2.AddItem "  Includes state block in DC:  Yes"
  348.     Else
  349.         list2.AddItem "  Includes state block in DC:  No"
  350.     End If
  351.     If dc.RASTERCAPS And RC_SAVEBITMAP Then
  352.         list2.AddItem "  Saves bitmaps locally:  Yes"
  353.     Else
  354.         list2.AddItem "  Saves bitmaps locally:  No"
  355.     End If
  356.     If dc.RASTERCAPS And RC_DI_BITMAP Then
  357.         list2.AddItem "  Supports DIB to memory:  Yes"
  358.     Else
  359.         list2.AddItem "  Supports DIB to memory:  No"
  360.     End If
  361.     If dc.RASTERCAPS And RC_PALETTE Then
  362.         list2.AddItem "  Supports a palette:  Yes"
  363.     Else
  364.         list2.AddItem "  Supports a palette:  No"
  365.     End If
  366.     If dc.RASTERCAPS And RC_DIBTODEV Then
  367.         list2.AddItem "  Supports bitmap conversion:  Yes"
  368.     Else
  369.         list2.AddItem "  Supports bitmap conversion:  No"
  370.     End If
  371.     If dc.RASTERCAPS And RC_BIGFONT Then
  372.         list2.AddItem "  Supports fonts >64K:  Yes"
  373.     Else
  374.         list2.AddItem "  Supports fonts >64K:  No"
  375.     End If
  376.     If dc.RASTERCAPS And RC_STRETCHBLT Then
  377.         list2.AddItem "  Supports StretchBlt:  Yes"
  378.     Else
  379.         list2.AddItem "  Supports StretchBlt:  No"
  380.     End If
  381.     If dc.RASTERCAPS And RC_FLOODFILL Then
  382.         list2.AddItem "  Supports FloodFill:  Yes"
  383.     Else
  384.         list2.AddItem "  Supports FloodFill:  No"
  385.     End If
  386.     If dc.RASTERCAPS And RC_STRETCHDIB Then
  387.         list2.AddItem "  Supports StretchDIBits:  Yes"
  388.     Else
  389.         list2.AddItem "  Supports StretchDIBits:  No"
  390.     End If
  391.     If dc.RASTERCAPS And RC_OP_DX_OUTPUT Then
  392.         list2.AddItem "  Supports opaque and DX array:  Yes"
  393.     Else
  394.         list2.AddItem "  Supports opaque and DX array:  No"
  395.     End If
  396.     If dc.RASTERCAPS And RC_DEVBITS Then
  397.         list2.AddItem "  Supports device bitmaps:  Yes"
  398.     Else
  399.         list2.AddItem "  Supports device bitmaps:  No"
  400.     End If
  401.  
  402. End Sub
  403.  
  404. Function tech (i)
  405.    Select Case i
  406.           Case DT_PLOTTER
  407.                tech = "Vector Plotter"
  408.           Case DT_RASDISPLAY
  409.                tech = "Raster Display"
  410.           Case DT_RASPRINTER
  411.                tech = "Raster printer"
  412.           Case DT_RASCAMERA
  413.                tech = "Raster Camera"
  414.           Case DT_CHARSTREAM
  415.                tech = "Character-stream PLP"
  416.           Case DT_METAFILE
  417.                tech = "Metafile, VDM"
  418.           Case DT_DISPFILE
  419.                tech = "Display-file"
  420.           Case Else
  421.                tech = "Unknown"
  422.    End Select
  423. End Function
  424.  
  425. Sub txt ()
  426.     If dc.TEXTCAPS = TC_NONE Then
  427.         list2.AddItem "TEXTCAPS:  None "
  428.         Exit Sub
  429.     Else
  430.         list2.AddItem "TEXTCAPS"
  431.     End If
  432.     If dc.TEXTCAPS And TC_OP_CHARACTER Then
  433.         list2.AddItem "  Character output precision:  Yes"
  434.     Else
  435.         list2.AddItem "  Character output precision:  No"
  436.     End If
  437.     If dc.TEXTCAPS And TC_OP_STROKE Then
  438.         list2.AddItem "  Stroke output precision:  Yes"
  439.     Else
  440.         list2.AddItem "  Stroke output precision:  No"
  441.     End If
  442.     If dc.TEXTCAPS And TC_CP_STROKE Then
  443.         list2.AddItem "  Stroke clip precision:  Yes"
  444.     Else
  445.         list2.AddItem "  Stroke clip precision:  No"
  446.     End If
  447.     If dc.TEXTCAPS And TC_CR_90 Then
  448.         list2.AddItem "  90 degree character rotation:  Yes"
  449.     Else
  450.         list2.AddItem "  90 degree character rotation:  No"
  451.     End If
  452.     If dc.TEXTCAPS And TC_CR_ANY Then
  453.         list2.AddItem "  Any character rotation:  Yes"
  454.     Else
  455.         list2.AddItem "  Any character rotation:  No"
  456.     End If
  457.     If dc.TEXTCAPS And TC_SF_X_YINDEP Then
  458.         list2.AddItem "  Scaling independent of x and y:  Yes"
  459.     Else
  460.         list2.AddItem "  Scaling independent of x and y:  No"
  461.     End If
  462.     If dc.TEXTCAPS And TC_SA_DOUBLE Then
  463.         list2.AddItem "  Doubled character for scaling:  Yes"
  464.     Else
  465.         list2.AddItem "  Doubled character for scaling:  No"
  466.     End If
  467.     If dc.TEXTCAPS And TC_SA_INTEGER Then
  468.         list2.AddItem "  Integer multiples for scaling:  Yes"
  469.     Else
  470.         list2.AddItem "  Integer multiples for scaling:  No"
  471.     End If
  472.     If dc.TEXTCAPS And TC_IA_ABLE Then
  473.         list2.AddItem "  Italicizing:  Yes"
  474.     Else
  475.         list2.AddItem "  Italicizing:  No"
  476.     End If
  477.     If dc.TEXTCAPS And TC_SA_CONTIN Then
  478.         list2.AddItem "  Any multiples for exact scaling:  Yes"
  479.     Else
  480.         list2.AddItem "  Any multiples for exact scaling:  No"
  481.     End If
  482.     If dc.TEXTCAPS And TC_EA_DOUBLE Then
  483.         list2.AddItem "  Double-weight characters:  Yes"
  484.     Else
  485.         list2.AddItem "  Double-weight characters:  No"
  486.     End If
  487.     If dc.TEXTCAPS And TC_UA_ABLE Then
  488.         list2.AddItem "  Underlining:  Yes"
  489.     Else
  490.         list2.AddItem "  Underlining:  No"
  491.     End If
  492.     If dc.TEXTCAPS And TC_SO_ABLE Then
  493.         list2.AddItem "  Strikeouts:  Yes"
  494.     Else
  495.         list2.AddItem "  Strikeouts:  No"
  496.     End If
  497.     If dc.TEXTCAPS And TC_RA_ABLE Then
  498.         list2.AddItem "  Raster fonts:  Yes"
  499.     Else
  500.         list2.AddItem "  Raster fonts:  No"
  501.     End If
  502.     If dc.TEXTCAPS And TC_VA_ABLE Then
  503.         list2.AddItem "  Vertor fonts:  Yes"
  504.     Else
  505.         list2.AddItem "  Vertor fonts:  No"
  506.     End If
  507. End Sub
  508.  
  509.