投稿日 | : 2003/02/26(Wed) 01:05 |
投稿者 | : Starfish |
Eメール | : |
URL | : |
タイトル | : Re^2: 便乗質問、&演算子を使用しない方法 |
強引ですが、こんなやり方もあるのかなぁ。
Private Sub Command5_Click()
Dim L As Long
Dim S() As Byte
Dim T As Single
Dim r As Byte
RichTextBox1.Text = ""
MsgBox "バイト配列にセットしてStrconv", vbInformation
ReDim S(MAX_COUNT * 2 - 1)
T = Timer
With RichTextBox1
.Visible = False
For L = 1 To MAX_COUNT
r = Int(Rnd * 255)
If (r \ 16) < 10 Then
S((L - 1) * 2) = 48 + (r \ 16)
Else
S((L - 1) * 2) = 55 + (r \ 16)
End If
If (r Mod 16) < 10 Then
S((L - 1) * 2 + 1) = 48 + (r Mod 16)
Else
S((L - 1) * 2 + 1) = 55 + (r Mod 16)
End If
Next
.Text = StrConv(S, vbUnicode)
.Visible = True
End With
MsgBox Format$(Timer - T, "0.000") & "秒かかりました。", vbInformation, "バイト配列"
End Sub
Private Sub Command6_Click()
Dim L As Long
Dim S As String
Dim T As Single
Dim r As Byte
RichTextBox1.Text = ""
MsgBox "Mid ステートメント", vbInformation
S = Space(MAX_COUNT * 2)
T = Timer
With RichTextBox1
.Visible = False
For L = 1 To MAX_COUNT
Mid(S, (L - 1) * 2 + 1, 2) = toHex(Int(Rnd * 255))
Next
.Text = S
.Visible = True
End With
MsgBox Format$(Timer - T, "0.000") & "秒かかりました。", vbInformation, "Mid ステートメント"
End Sub