home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples5 / ch07 / devview.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.8 KB  |  102 lines

  1. VERSION 5.00
  2. Begin VB.Form Devview 
  3.    Caption         =   "Device Context Viewer"
  4.    ClientHeight    =   4065
  5.    ClientLeft      =   1095
  6.    ClientTop       =   1485
  7.    ClientWidth     =   7365
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    LinkMode        =   1  'Source
  19.    LinkTopic       =   "Form1"
  20.    PaletteMode     =   1  'UseZOrder
  21.    ScaleHeight     =   4065
  22.    ScaleWidth      =   7365
  23.    Begin VB.TextBox Text1 
  24.       BackColor       =   &H00C0C0C0&
  25.       Height          =   3855
  26.       Left            =   120
  27.       MultiLine       =   -1  'True
  28.       TabIndex        =   0
  29.       Top             =   120
  30.       Width           =   5895
  31.    End
  32.    Begin VB.CommandButton Command1 
  33.       Caption         =   "Form"
  34.       Height          =   495
  35.       Left            =   6240
  36.       TabIndex        =   1
  37.       Top             =   120
  38.       Width           =   975
  39.    End
  40.    Begin VB.CommandButton Command2 
  41.       Caption         =   "Printer"
  42.       Height          =   495
  43.       Left            =   6240
  44.       TabIndex        =   2
  45.       Top             =   720
  46.       Width           =   975
  47.    End
  48. Attribute VB_Name = "Devview"
  49. Attribute VB_GlobalNameSpace = False
  50. Attribute VB_Creatable = False
  51. Attribute VB_PredeclaredId = True
  52. Attribute VB_Exposed = False
  53. Option Explicit
  54. ' Copyright 
  55.  1997 by Desaware Inc. All Rights Reserved
  56. Private Sub Command1_Click()
  57.     LoadInfo Devview.hDC
  58. End Sub
  59. Private Sub Command2_Click()
  60.     LoadInfo Printer.hDC
  61. End Sub
  62. '   Loads the edit box with information about the DC
  63. Private Sub LoadInfo(usehDC&)
  64.     Dim a$
  65.     #If Win32 Then
  66.     Dim r As Long
  67.     Dim nhDC As Long
  68.     #Else
  69.     Dim r As Integer
  70.     Dim nhDC As Integer
  71.     #End If
  72.     nhDC = usehDC
  73.     Dim crlf$
  74.     crlf$ = Chr$(13) + Chr$(10)
  75.     r = GetDeviceCaps(nhDC, TECHNOLOGY)
  76.     If r And DT_RASPRINTER Then a$ = "Raster Printer"
  77.     If r And DT_RASDISPLAY Then a$ = "Raster Display"
  78.     ' You can detect other technology types here - see the
  79.     ' GetDeviceCaps function description for technology types
  80.     If a$ = "" Then a$ = "Other technology"
  81.     a$ = a$ + crlf$
  82.     a$ = a$ + "X,Y Dimensions in pixels:" + Str$(GetDeviceCaps(nhDC, HORZRES)) + "," + Str$(GetDeviceCaps(nhDC, VERTRES)) + crlf$
  83.     a$ = a$ + "X,Y Pixels/Logical Inch:" + Str$(GetDeviceCaps(nhDC, LOGPIXELSX)) + "," + Str$(GetDeviceCaps(nhDC, LOGPIXELSY)) + crlf$
  84.     a$ = a$ + "Bits/Pixel:" + Str$(GetDeviceCaps(nhDC, BITSPIXEL)) + crlf$
  85.     a$ = a$ + "Color Planes:" + Str$(GetDeviceCaps(nhDC, PLANES)) + crlf$
  86.     a$ = a$ + "Color Table Entries:" + Str$(GetDeviceCaps(nhDC, NUMCOLORS)) + crlf$
  87.     a$ = a$ + "Aspect X,Y,XY:" + Str$(GetDeviceCaps(nhDC, ASPECTX)) + "," + Str$(GetDeviceCaps(nhDC, ASPECTY)) + "," + Str$(GetDeviceCaps(nhDC, ASPECTXY)) + crlf$
  88.     r = GetDeviceCaps(nhDC, RASTERCAPS)
  89.     a$ = a$ + crlf$ + "Device capabilities:" + crlf$
  90.     If r And RC_BANDING Then a$ = a$ + "Banding" + crlf$
  91.     If r And RC_BIGFONT Then a$ = a$ + "Fonts >64K" + crlf$
  92.     If r And RC_BITBLT Then a$ = a$ + "BitBlt" + crlf$
  93.     If r And RC_BITMAP64 Then a$ = a$ + "Bitmaps >64k" + crlf$
  94.     If r And RC_DI_BITMAP Then a$ = a$ + "Device Independent Bitmaps" + crlf$
  95.     If r And RC_DIBTODEV Then a$ = a$ + "DIB to device" + crlf$
  96.     If r And RC_FLOODFILL Then a$ = a$ + "Flood fill" + crlf$
  97.     If r And RC_SCALING Then a$ = a$ + "Scaling" + crlf$
  98.     If r And RC_STRETCHBLT Then a$ = a$ + "StretchBlt" + crlf$
  99.     If r And RC_STRETCHDIB Then a$ = a$ + "StretchDIB" + crlf$
  100.     Text1.Text = a$
  101. End Sub
  102.