(The Comprehensive Document Comparison
Using 'Diff Doc' as an ActiveX Component
For COM+ (i.e. with IIS) users
One very important note is that
DiffDoc.EXE is both an executable application AND an ActiveX component.
That is, the file, DiffDoc.EXE, can be ran as a stand alone application,
and, can be referenced as a component within your development environment.
First, be sure to uninstall any
previous versions of 'Diff Doc' before using the ActiveX version. Next,
Directly below is
some VBS (Visual Basic Script). You could put the following 3
lines in a text file, call it TEST.VBS and give it a go:
set converter = WScript.CreateObject("DiffDoc.clsDiffDoc")
result = converter.DoCommandLine("/SC:\IN\Tryme.txt
/MC:\IN\Tryme2.txt /X /V")
For Visual Basic users,
simply make a reference to the DiffDoc.EXE application in the
Tools\References menu item. Once done you now have access
to the DiffDoc component.
Here is some sample code illustrating its usage:
to download the VB6 demo.
HERE to download the VB.NET demo.
Private Sub Command1_Click()
Dim dd As DiffDoc.clsDiffDoc
Set dd = New DiffDoc.clsDiffDoc
dd.Key = "" ' Assign Key To the 'Final Key', given upon
' Run by the command line. See 'Diff Doc' documentation for a
full listing of
' switches and options.
lRetVal = dd.DoCommandLine("/SE:\Delme\Test1.txt
/ME:\Delme\Test2.txt /TE:\Delme\ReportOut.DOC /F1 /R4 /X ")
' DoCommandLine() Return Values
' 0 = Success
' -1 = Shareware expired
' -2 = Command line String Emtpy or invalid.
' -3 = Missing required command line argument(s)
If (lRetVal = 0 And dd.NumDifferencesFound > 0)
Call ShellExecuteAny(Me.hwnd, "open", "E:\Delme\ReportOut.DOC", ByVal 0&,
ByVal 0&, 4)
Set dd = Nothing ' Closes 'Diff Doc' application
As you can see from the
code above, the ActiveX wrapper simply wraps the command line
feature. So, to learn what you can do with the ActiveX, please
refer to the 'Using the Command Line' section of the
'Diff Doc' users manual. Also, you will have to change
the path information in the DoCommandLine() method for your
particular set of files you are comparing.
This function emulates doing the command line, but through the COM
0 = Success
-1 = Shareware expired
-2 = Command line String Empty or
-3 = Missing required command line
Returns the number of differences found
while doing a comparison of files or folders.