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 / samples4 / ch07 / devview.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.8 KB  |  103 lines

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