home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / vbasic / Data / Utils / glm2demo.exe / %MAINDIR% / Scanner / frmTwainTest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2002-06-10  |  3.7 KB  |  123 lines

  1. VERSION 5.00
  2. Object = "{9EBAE797-FE30-11D2-8C95-00001C500B3F}#1.0#0"; "dwTwainD.ocx"
  3. Begin VB.Form frmTwainTest 
  4.    Caption         =   "Twain Control Test"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   165
  7.    ClientTop       =   1305
  8.    ClientWidth     =   4680
  9.    Icon            =   "frmTwainTest.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3195
  12.    ScaleWidth      =   4680
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin dwTwain5Demo.TwainControl TwainControl1 
  15.       Height          =   2895
  16.       Left            =   240
  17.       Top             =   60
  18.       Width           =   3075
  19.       _ExtentX        =   5424
  20.       _ExtentY        =   5106
  21.       BorderStyle     =   1
  22.       VersionInfo     =   "1.0 Twain Control"
  23.       ProductFamily   =   "Desaware ActiveX Controls"
  24.       ProductName     =   "Desaware ActiveX Gallimaufry"
  25.       Manufacturer    =   "Desaware Inc."
  26.    End
  27.    Begin VB.CommandButton cmdScanSelect 
  28.       Caption         =   "Select..."
  29.       Height          =   465
  30.       Left            =   3510
  31.       TabIndex        =   1
  32.       Top             =   90
  33.       Width           =   1005
  34.    End
  35.    Begin VB.CommandButton cmdCloseUI 
  36.       Caption         =   "Close"
  37.       Height          =   465
  38.       Left            =   3510
  39.       TabIndex        =   2
  40.       Top             =   1170
  41.       Width           =   1005
  42.    End
  43.    Begin VB.CommandButton cmdScan 
  44.       Caption         =   "Acquire..."
  45.       Height          =   465
  46.       Left            =   3510
  47.       TabIndex        =   0
  48.       Top             =   630
  49.       Width           =   1005
  50.    End
  51.    Begin VB.Menu mnuHelp 
  52.       Caption         =   "Help"
  53.       Begin VB.Menu mnuAbout 
  54.          Caption         =   "About..."
  55.       End
  56.       Begin VB.Menu mnuOther 
  57.          Caption         =   "Other Products..."
  58.       End
  59.    End
  60. Attribute VB_Name = "frmTwainTest"
  61. Attribute VB_GlobalNameSpace = False
  62. Attribute VB_Creatable = False
  63. Attribute VB_PredeclaredId = True
  64. Attribute VB_Exposed = False
  65. ' TwainTest sample program
  66. ' Copyright 
  67.  1999 by Desaware Inc. All Rights Reserved
  68. Option Explicit
  69. Private Sub cmdCloseUI_Click()
  70.    TwainControl1.CloseScanner
  71. End Sub
  72. Private Sub OpenScanner(ByVal UseDefault As Boolean)
  73.    Dim v As Variant
  74.    Dim X As Integer
  75.    Dim ftt As frmTwainOptions
  76.    ManageButtons True
  77.    ' If scanner is not already open, prompt user to select
  78.    If TwainControl1.ControlState < 2 Then
  79.       TwainControl1.OpenAndSelectScanner UseDefault
  80.    End If
  81.    ' If user cancelled the operation and didn't open the scanner
  82.    ' Just exit.
  83.    If TwainControl1.ControlState = 0 Then
  84.       ManageButtons False
  85.       Exit Sub
  86.    End If
  87.       
  88.    ' If disk transfer is supported, allow user to
  89.    ' select options
  90.    If TwainControl1.IsDiskTransferSupported() Then
  91.       Set ftt = New frmTwainOptions
  92.       Set ftt.SourceControl = TwainControl1
  93.       ftt.Show vbModal
  94.       Set ftt = Nothing
  95.    End If
  96.    TwainControl1.ScanImageWithUI
  97.    ManageButtons False
  98. End Sub
  99. Private Sub cmdScan_Click()
  100.    OpenScanner False
  101. End Sub
  102. Private Sub ManageButtons(Disable As Boolean)
  103.    cmdScanSelect.Enabled = Not Disable
  104.    cmdScan.Enabled = Not Disable
  105. End Sub
  106. Private Sub cmdScanSelect_Click()
  107.    ManageButtons True
  108.    TwainControl1.OpenAndSelectScanner
  109.    ManageButtons False
  110. End Sub
  111. Private Sub Form_Unload(Cancel As Integer)
  112.    TwainControl1.CloseScanner
  113. End Sub
  114. Private Sub mnuAbout_Click()
  115.    frmAbout.Show vbModal
  116. End Sub
  117. Private Sub mnuOther_Click()
  118.    sdother.Show vbModal
  119. End Sub
  120. Private Sub TwainControl1_ImageScanned(ByVal PendingImages As Integer, cancelpending As Boolean)
  121.    Call TwainControl1.SaveImageToFile("c:\temp\test.bmp")
  122. End Sub
  123.