Option Explicit
Dim Timer As Date
Sub TimerStart()
Range("A1") = Format$(Now, "yy年mm月dd日 hh時mm分ss秒")
Timer = DateAdd("s", 1, Now)
Call Application.OnTime(Timer, "TimerStart")
End Sub
Sub TimerStop()
Call Application.OnTime(Timer, "TimerStart", , False)
End Sub
Private Declare Sub SetString Lib "c:\shard.dll" (ByVal str As String)
Private Declare Function GetString Lib "c:\shard.dll" () As String
Private Sub Command1_Click()
Call SetString(Text1(0).Text + vbCrLf _
+ Text1(1).Text + vbCrLf _
+ Text1(2).Text + vbCrLf _
+ Text1(3).Text + vbCrLf _
+ Text1(4).Text + vbCrLf _
) '共有メモリに書き込み
End Sub
Private Sub Timer1_Timer()
Dim str As String
Dim ar As Variant
ar = Split(GetString(), vbCrLf)
If 9 <= UBound(ar) Then
Label1(0).Caption = ar(5)
Label1(1).Caption = ar(6)
Label1(2).Caption = ar(7)
Label1(3).Caption = ar(8)
Label1(4).Caption = ar(9)
End If
End Sub
Public Function readData(index As Integer) As String
If readArea < index Then
readData = str_ar(index)
Else
readData = "NG"
End If
End Function
Public Function writeData(index As Integer, data As String) As String
If readArea <= index And writeArea > index Then
str_ar(index + readArea - 1) = data
writeData = CStr(index) + " Write OK"
Else
writeData = CStr(index) + " Write NG"
End If
End Function