?? s2l4.bas
字號(hào):
Option Explicit
'**********************************************************************
'* S2L4.bas - (Section 2, Lesson 4) SENDING AN INTEGER TO THE TARGET
'* This is the RTDX Host Client for Section 2, Lesson 4
'*
'* This example sends integer value 5 to the target
'**********************************************************************
Const Success = &H0 ' Method call is valid
Const Failure = &H80004005 ' Method call failed
Const ENoDataAvailable = &H8003001E ' No data was available.
' However, more data may be
' available in the future.
Const EEndOfLogFile = &H80030002 ' No data was available
' The end of the log file has
' been reached.
Const VALUE_TO_SEND = 5
Sub main()
Dim rtdx As Object
Dim data As Integer
Dim bufferstate As Long
Dim status As Long
On Error GoTo Error_Handler
' Create an instance of the RTDX COM object
Set rtdx = CreateObject("RTDX")
' Open channel ichan for writing
status = rtdx.Open("ichan", "W")
If status <> Success Then
Debug.Print "Opening of channel ichan failed"
GoTo Error_Handler
End If
data = VALUE_TO_SEND
'******************************************************************
' Insert code from Step #3 here - to send a 16-bit integer to the
' target
'******************************************************************
status = rtdx.WriteI2(data, bufferstate)
If status = Success Then
Debug.Print "Value " & data & " was sent to the target"
Else
Debug.Print "WriteI2 failed"
End If
' Close the channel
status = rtdx.Close()
' Release the reference to the RTDX COM object
Set rtdx = Nothing
Exit Sub
Error_Handler:
Debug.Print "Error in COM method call"
Set rtdx = Nothing
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -