home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / ch_code / appx_c / mcitest / mcitest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-07-03  |  7.4 KB  |  226 lines

  1. VERSION 5.00
  2. Begin VB.Form MCITestForm 
  3.    Caption         =   "MCITest"
  4.    ClientHeight    =   6405
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   8205
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   6405
  10.    ScaleWidth      =   8205
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.TextBox History 
  13.       Height          =   1890
  14.       Left            =   270
  15.       Locked          =   -1  'True
  16.       MultiLine       =   -1  'True
  17.       TabIndex        =   8
  18.       Top             =   4320
  19.       Width           =   7755
  20.    End
  21.    Begin VB.CommandButton Command1 
  22.       Caption         =   "Execute Command"
  23.       BeginProperty Font 
  24.          Name            =   "MS Sans Serif"
  25.          Size            =   9.75
  26.          Charset         =   0
  27.          Weight          =   400
  28.          Underline       =   0   'False
  29.          Italic          =   0   'False
  30.          Strikethrough   =   0   'False
  31.       EndProperty
  32.       Height          =   405
  33.       Left            =   5625
  34.       TabIndex        =   2
  35.       Top             =   795
  36.       Width           =   2355
  37.    End
  38.    Begin VB.TextBox MCIcommand 
  39.       BeginProperty Font 
  40.          Name            =   "MS Sans Serif"
  41.          Size            =   9.75
  42.          Charset         =   0
  43.          Weight          =   400
  44.          Underline       =   0   'False
  45.          Italic          =   0   'False
  46.          Strikethrough   =   0   'False
  47.       EndProperty
  48.       Height          =   855
  49.       Left            =   240
  50.       TabIndex        =   0
  51.       Top             =   375
  52.       Width           =   5250
  53.    End
  54.    Begin VB.Label MCIerror 
  55.       BorderStyle     =   1  'Fixed Single
  56.       BeginProperty Font 
  57.          Name            =   "MS Sans Serif"
  58.          Size            =   9.75
  59.          Charset         =   0
  60.          Weight          =   400
  61.          Underline       =   0   'False
  62.          Italic          =   0   'False
  63.          Strikethrough   =   0   'False
  64.       EndProperty
  65.       Height          =   315
  66.       Left            =   1935
  67.       TabIndex        =   10
  68.       Top             =   2018
  69.       Width           =   915
  70.    End
  71.    Begin VB.Label Label4 
  72.       Caption         =   "Error Code "
  73.       BeginProperty Font 
  74.          Name            =   "MS Sans Serif"
  75.          Size            =   9.75
  76.          Charset         =   0
  77.          Weight          =   400
  78.          Underline       =   0   'False
  79.          Italic          =   0   'False
  80.          Strikethrough   =   0   'False
  81.       EndProperty
  82.       Height          =   300
  83.       Left            =   255
  84.       TabIndex        =   9
  85.       Top             =   2025
  86.       Width           =   1230
  87.    End
  88.    Begin VB.Label Label6 
  89.       Caption         =   "Command History"
  90.       BeginProperty Font 
  91.          Name            =   "MS Sans Serif"
  92.          Size            =   9.75
  93.          Charset         =   0
  94.          Weight          =   400
  95.          Underline       =   0   'False
  96.          Italic          =   0   'False
  97.          Strikethrough   =   0   'False
  98.       EndProperty
  99.       Height          =   270
  100.       Left            =   300
  101.       TabIndex        =   7
  102.       Top             =   3900
  103.       Width           =   1950
  104.    End
  105.    Begin VB.Label MCIstr 
  106.       BorderStyle     =   1  'Fixed Single
  107.       BeginProperty Font 
  108.          Name            =   "MS Sans Serif"
  109.          Size            =   9.75
  110.          Charset         =   0
  111.          Weight          =   400
  112.          Underline       =   0   'False
  113.          Italic          =   0   'False
  114.          Strikethrough   =   0   'False
  115.       EndProperty
  116.       Height          =   630
  117.       Left            =   1935
  118.       TabIndex        =   6
  119.       Top             =   2475
  120.       Width           =   6030
  121.    End
  122.    Begin VB.Label MCIcode 
  123.       BorderStyle     =   1  'Fixed Single
  124.       BeginProperty Font 
  125.          Name            =   "MS Sans Serif"
  126.          Size            =   9.75
  127.          Charset         =   0
  128.          Weight          =   400
  129.          Underline       =   0   'False
  130.          Italic          =   0   'False
  131.          Strikethrough   =   0   'False
  132.       EndProperty
  133.       Height          =   315
  134.       Left            =   1935
  135.       TabIndex        =   5
  136.       Top             =   1440
  137.       Width           =   6045
  138.    End
  139.    Begin VB.Label Label3 
  140.       Caption         =   "Return String"
  141.       BeginProperty Font 
  142.          Name            =   "MS Sans Serif"
  143.          Size            =   9.75
  144.          Charset         =   0
  145.          Weight          =   400
  146.          Underline       =   0   'False
  147.          Italic          =   0   'False
  148.          Strikethrough   =   0   'False
  149.       EndProperty
  150.       Height          =   270
  151.       Left            =   195
  152.       TabIndex        =   4
  153.       Top             =   2610
  154.       Width           =   1380
  155.    End
  156.    Begin VB.Label Label2 
  157.       Caption         =   "Return Code"
  158.       BeginProperty Font 
  159.          Name            =   "MS Sans Serif"
  160.          Size            =   9.75
  161.          Charset         =   0
  162.          Weight          =   400
  163.          Underline       =   0   'False
  164.          Italic          =   0   'False
  165.          Strikethrough   =   0   'False
  166.       EndProperty
  167.       Height          =   270
  168.       Left            =   255
  169.       TabIndex        =   3
  170.       Top             =   1455
  171.       Width           =   1185
  172.    End
  173.    Begin VB.Label Label1 
  174.       Caption         =   "Enter MCI Command here"
  175.       BeginProperty Font 
  176.          Name            =   "MS Sans Serif"
  177.          Size            =   9.75
  178.          Charset         =   0
  179.          Weight          =   400
  180.          Underline       =   0   'False
  181.          Italic          =   0   'False
  182.          Strikethrough   =   0   'False
  183.       EndProperty
  184.       Height          =   270
  185.       Left            =   270
  186.       TabIndex        =   1
  187.       Top             =   75
  188.       Width           =   2760
  189.    End
  190. Attribute VB_Name = "MCITestForm"
  191. Attribute VB_GlobalNameSpace = False
  192. Attribute VB_Creatable = False
  193. Attribute VB_PredeclaredId = True
  194. Attribute VB_Exposed = False
  195. Private Declare Function mciSendStringA Lib "WinMM" _
  196.     (ByVal MCIcommand As String, ByVal returnStr As String, _
  197.     ByVal returnLength As Integer, ByVal callBack As Integer) As Long
  198. Private Declare Function mciGetErrorStringA Lib "WinMM" _
  199.     (ByVal error As Long, ByVal buffer As String, _
  200.     ByVal length As Integer) As Integer
  201. Dim errorCode As Integer
  202. Dim returnStr As String * 255
  203. Dim returnCode As Integer
  204. Dim errorStr As String * 255
  205. Private Sub Command1_Click()
  206.     errorCode = mciSendStringA(MCIcommand.Text, _
  207.                 returnStr, 255, 0)
  208.     MCIerror.Caption = errorCode
  209.     returnCode = mciGetErrorStringA(errorCode, errorStr, 255)
  210.     MCIcode.Caption = returnStr
  211.     MCIstr.Caption = errorStr
  212.     If errorCode = 0 Then History.Text = History.Text & MCIcommand.Text & Chr$(13) & Chr$(10)
  213. End Sub
  214. Private Sub Form_Load()
  215.     ChDrive App.Path
  216.     ChDir App.Path
  217. End Sub
  218. Private Sub Form_Unload(Cancel As Integer)
  219.     reply = MsgBox("You must close all devices you have opened in this application." & vbCrLf & _
  220.            "(use the close command with the device's alias, as 'close device_alias')" & vbCrLf & _
  221.            "Are you sure you want to quit?", vbYesNo)
  222.     If reply = vbNo Then
  223.         Cancel = True
  224.     End If
  225. End Sub
  226.