掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
ユーザー定義型を比較するには? (ID:76886)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
fcを使うという手もあります。 ファイルを介するのがいやなら、 WshShellオブジェクトかCreatePipeAPIで 標準出力を取得する必要があります。 Option Explicit Private Const FILEPATH As String = "C:\FCTEST\UDTA_" Private Type AType a As Long b As Integer c As String d As Byte End Type Private udtA(3) As AType Private Sub FileComp(file1 As Long, file2 As Long) Shell "cmd.exe /C fc /B " _ & FILEPATH & CStr(file1) & ".BIN " _ & FILEPATH & CStr(file2) & ".BIN " _ & " > " & FILEPATH & CStr(file1) & CStr(file2) & ".TXT " End Sub Private Sub Command1_Click() Dim strFileName As String Dim lnfFileHandle As Long Dim i As Long 'udtA(0)の設定 udtA(0).a = 100 udtA(0).b = 10 udtA(0).c = "aaa" udtA(0).d = 1 'udtA(0)のコピー udtA(1) = udtA(0) udtA(2) = udtA(0) udtA(3) = udtA(0) 'udtA(2)は1箇所、udtA(3)は2箇所変更 udtA(2).a = 200 udtA(3).b = 20 udtA(3).d = 2 'とりあえず保存 For i = 0 To 3 strFileName = FILEPATH & CStr(i) & ".bin" lnfFileHandle = FreeFile Open strFileName For Binary Access Write As #lnfFileHandle Put #lnfFileHandle, , udtA(i) Close #lnfFileHandle Next MsgBox "OK" End Sub Private Sub Command2_Click() FileComp 0, 1 FileComp 0, 2 FileComp 0, 3 MsgBox "OK" End Sub Private Sub Command3_Click() Dim strFileName As String Dim lnfFileHandle As Long Dim strFileNo(2) As String Dim strResult As String strFileNo(0) = "01" strFileNo(1) = "02" strFileNo(2) = "03" Dim i As Long For i = 0 To 2 strFileName = FILEPATH & strFileNo(i) & ".txt" lnfFileHandle = FreeFile Open strFileName For Input As #lnfFileHandle Do Until EOF(lnfFileHandle) Line Input #lnfFileHandle, strResult List1.AddItem strResult DoEvents Loop Close #lnfFileHandle List1.AddItem "=============================================" Next MsgBox "OK" End Sub
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.