VERSION 5.00 Begin VB.Form INT Caption = "Form1" ClientHeight = 4470 ClientLeft = 60 ClientTop = 420 ClientWidth = 7215 BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty LinkTopic = "Form1" ScaleHeight = 4470 ScaleWidth = 7215 StartUpPosition = 3 '´°¿Úȱʡ Begin VB.Timer Timer1 Enabled = 0 'False Interval = 100 Left = 3240 Top = 3960 End Begin VB.TextBox Text2 Height = 375 Left = 3360 TabIndex = 3 Top = 1680 Width = 1935 End Begin VB.CommandButton Command2 Caption = "Stop" Height = 375 Left = 3840 TabIndex = 1 Top = 3240 Width = 1215 End Begin VB.CommandButton Command1 Caption = "Start" Height = 375 Left = 2160 TabIndex = 0 Top = 3240 Width = 1215 End Begin VB.Label Label2 Caption = "Whether DI0 interrupt" Height = 255 Left = 1320 TabIndex = 2 Top = 1680 Width = 1695 End End Attribute VB_Name = "INT" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim hDevice As Long Dim DeviceID As Integer Dim hEventInt As Long Dim Flag As Long Dim wait As Boolean Private Sub Command1_Click() DeviceID = 0 wait = True hDevice = PCI2312_CreateDevice(DeviceID) If hDevice = INVALID_HANDLE_VALUE Then MsgBox "Create Device Error..." Exit Sub End If hEventInt = PCI2312_CreateSystemEvent() If hDevice = INVALID_HANDLE_VALUE Then MsgBox "Create Device Error..." Exit Sub End If If (PCI2312_InitDeviceInt(hDevice, hEventInt) = False) Then MsgBox ("InitDeviceInt Error...") Exit Sub End If Me.Timer1.Enabled = True Me.Command1.Enabled = False Me.Command2.Enabled = True End Sub Private Sub Command2_Click() Me.Timer1.Enabled = False If hDevice <> INVALID_HANDLE_VALUE Then PCI2312_ReleaseDeviceInt (hDevice) PCI2312_ReleaseSystemEvent (hEventInt) PCI2312_ReleaseDevice (hDevice) Me.Command1.Enabled = True Me.Command2.Enabled = False End If Exit Sub End Sub Private Sub Form_Unload(Cancel As Integer) Me.Timer1.Enabled = False If hDevice <> INVALID_HANDLE_VALUE Then PCI2312_ReleaseDeviceInt (hDevice) PCI2312_ReleaseSystemEvent (hEventInt) PCI2312_ReleaseDevice (hDevice) Me.Command1.Enabled = True Me.Command2.Enabled = False End If Exit Sub End Sub Private Sub Timer1_Timer() While (WaitForSingleObject(hEventInt, 100) <> 0) If wait = False Then Exit Sub End If Wend Flag = PCI2312_GetDeviceIntCount(hDevice) Text2.Text = Flag wait = False Me.Command2.Enabled = True End Sub