Windiff
Microsoft Develop Studio安装是就提供了。
还有Source Safe也提供了同样的功能。

解决方案 »

  1.   

    'Description: Compares the content of two filesFunction CompareFiles(cFile1 As String, cFile2 As String) As Boolean    Dim IsSame%
        Dim Start&
        Dim Whole&
        Dim Part&
        Dim Buffer1$
        Dim Buffer2$
        Dim x&
            
        Open cFile1 For Binary As #1
        Open cFile2 For Binary As #2
        
        IsSame% = True
        
        If LOF(1) <> LOF(2) Then
                IsSame% = False
        Else
                Whole& = LOF(1) \ 10000         'number of whole 10,000 byte chunks
                Part& = LOF(1) Mod 10000        'remaining bytes at end of file
                Buffer1$ = String$(10000, 0)
                Buffer2$ = String$(10000, 0)
                Start& = 1
                
                For x& = 1 To Whole&            'this for-next loop will get 10,000
                    Get #1, Start&, Buffer1$      'byte chunks at a time.
                    Get #2, Start&, Buffer2$
                    If Buffer1$ <> Buffer2$ Then
                            IsSame% = False
                            Exit For
                    End If
                    Start& = Start& + 10000
                Next
                
                Buffer1$ = String$(Part&, 0)
                Buffer2$ = String$(Part&, 0)
                Get #1, Start&, Buffer1$        'get the remaining bytes at the end
                Get #2, Start&, Buffer2$        'get the remaining bytes at the end
                If Buffer1$ <> Buffer2$ Then IsSame% = False
        End If
                
        Close #1
        Close #2
        
        If IsSame% Then
            CompareFiles = True
            'MessageBox frmMain.hWnd, "两个文件是一样的!", 64 + vbSystemModal, "比较结果"
        Else
            'MessageBox frmMain.hWnd, "两个文件是不一样的!", 16 + vbSystemModal, "比较结果"
            CompareFiles = False
        End IfEnd Function