home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 5 / MasteringVisualBasic5.iso / ch_code / ch08 / mcitest / mcitest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-20  |  7.3 KB  |  226 lines

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