BinaryComparison Object

On this page:

Description

This object represents a binary file comparison window. The window isn’t necessarily visible on screen and can be used either to perform file comparison services for a client, or to present file comparisons on the screen to the user.

Use the methods and properties exposed by this object to perform binary file comparisons, and to alter the appearance of a binary file comparison window.

Once the comparison represented by this object is closed, the handler for the Close event provides the final opportunity to access methods and properties. Accessing them after this time will result in an error.

Properties

Active read/write, ICommonUI

The active state of the comparison window.

IDL [propget] HRESULT Active([out, retval] VARIANT_BOOL* pValue)
[propput] HRESULT Active([in] VARIANT_BOOL newValue)
.NET Boolean Active[get, set]

AllUnresolvedConflicts read-only, IFileComparison

Not currently used.

AutoSaveOnClose read/write, IFileComparison

Not currently used.

ChangeLength read-only, IBinaryComparison

The number of lines in a change.

IDL [propget] HRESULT ChangeLength(
    [in] long nChange,
    [in] long nSide,
    [in, optional] VARIANT nFilePair,
    [out, retval] long* pValue)
.NET Int32 get_ChangeLength(
    Int32 nChange,
    Int32 nSide,
    Object nFilePair)

ChangeStartLine read-only, IBinaryComparison

The starting byte offset (0 based) of a change.

IDL [propget] HRESULT ChangeStartLine(
    [in] long nChange,
    [in] long nSide,
    [in, optional] VARIANT nFilePair,
    [out, retval] long* pValue)
.NET Int32 get_ChangeStartLine(
    Int32 nChange,
    Int32 nSide,
    Object nFilePair)

ChangeType read-only, IBinaryComparison

The type of a change. A change represents a block of inserted, removed, changed, or unchanged lines.

IDL [propget] HRESULT ChangeType(
    [in] long nChange,
    [in, optional] VARIANT nFilePair,
    [out, retval] ChangeStyle* pValue)
.NET ChangeStyle get_ChangeType(
    Int32 nChange,
    Object nFilePair)

ComparisonError read-only, IFileComparison

The error (if any) that was encountered by the Compare method.

IDL [propget] HRESULT ComparisonError(
    [in, optional] VARIANT nFilePair,
    [out, retval] FileComparisonError* pValue)
.NET FileComparisonError get_ComparisonError(
    Object nFilePair)

ComparisonResult read-only, IFileComparison

The result (fcrSame, fcrDifferent, fcrError) of the comparison performed by the Compare method.

IDL [propget] HRESULT ComparisonResult(
    [in, optional] VARIANT nFilePair,
    [out, retval] FileComparisonResult* pValue)
.NET FileComparisonResult get_ComparisonResult(
    Object nFilePair)

ErrorInfo read/write, IFileComparison

Provides detailed information about errors encountered while loading/comparing one of the files. If nFile is -1, then errors that applied to all three files (for example, out of memory errors) are returned.

IDL [propget] HRESULT ErrorInfo(
    [in] short nFile,
    [out, retval] BSTR* pValue)
[propput] HRESULT ErrorInfo(
    [in] short nFile,
    [in] BSTR newValue)
.NET String get_ErrorInfo(
    Int16 nFile)
void set_ErrorInfo(
    Int16 nFile, String newValue)

Height read/write, ICommonUI

The height of the comparison window in pixels.

IDL [propget] HRESULT Height([out, retval] long* pValue)
[propput] HRESULT Height([in] long newValue)
.NET Int32 Height[get, set]

Left read/write, ICommonUI

The location of the left edge pixel coordinate of the comparison window.

IDL [propget] HRESULT Left([out, retval] long* pValue)
[propput] HRESULT Left([in] long newValue)
.NET Int32 Left[get, set]

Maximized read/write, ICommonUI

The maximized state of the comparison window.

IDL [propget] HRESULT Maximized([out, retval] VARIANT_BOOL* pValue)
[propput] HRESULT Maximized([in] VARIANT_BOOL newValue)
.NET Boolean Maximized[get, set]

Minimized read/write, ICommonUI

The minimized state of the comparison window.

IDL [propget] HRESULT Minimized([out, retval] VARIANT_BOOL* pValue)
[propput] HRESULT Minimized([in] VARIANT_BOOL newValue)
.NET Boolean Minimized[get, set]

Modified read/write, IFileComparison

Not currently used.

NumberOfBytes read-only, IBinaryComparison

The number of bytes in one of the compared files.

IDL [propget] HRESULT NumberOfBytes(
    [in] short nFile,
    [out, retval] short* pValue)
.NET Int16 get_NumberOfBytes(
    Int16 nFile)

NumberOfChanges read-only, IFileComparison

The number of changes between two files.

IDL [propget] HRESULT NumberOfChanges(
    [in, optional] VARIANT nFilePair,
    [out, retval] long* pValue)
.NET Int32 get_NumberOfChanges(
    Object nFilePair)

PromptForUnsavedFiles read/write, IFileComparison

Not currently used.

ReadOnly read/write, IFileComparison

Not currently used.

SaveFileName read/write, IFileComparison

Not currently used.

ThreeWayMergeActions read-only, IFileComparison

Not currently used.

Top read/write, ICommonUI

The location of the top edge pixel coordinate of the comparison window.

IDL [propget] HRESULT Top([out, retval] long* pValue)
[propput] HRESULT Top([in] long newValue)
.NET Int32 Top[get, set]

UnresolvedConflicts read-only, IFileComparison

Not currently used.

ViewType read/write, IComparison

The comparison type (two way or three way layout).

IDL [propget] HRESULT ViewType([out, retval] FileViewType* pValue)
[propput] HRESULT ViewType([in] FileViewType newValue)
.NET FileViewType ViewType[get, set]

Visible read/write, ICommonUI

The visible state of the comparison window.

IDL [propget] HRESULT Visible([out, retval] VARIANT_BOOL* pValue)
[propput] HRESULT Visible([in] VARIANT_BOOL newValue)
.NET Boolean Visible[get, set]

Width read/write, ICommonUI

The width of the comparison window in pixels.

IDL [propget] HRESULT Width([out, retval] long* pValue)
[propput] HRESULT Width([in] long newValue)
.NET Int32 Width[get, set]

Methods

Close ICommonUI

Closes the comparison window.

IDL HRESULT Close()
.NET void Close()

Compare IComparison

Compares two or three files. This method is synchronous. An event ComparisonComplete is fired when the comparison is finished to report errors and results.

IDL HRESULT Compare(
    [in] VARIANT strFirstFile,
    [in] VARIANT strSecondFile,
    [in, optional] VARIANT strThirdFile)
.NET void Compare(
    Object strFirstFile,
    Object strSecondFile,
    Object strThirdFile)

CompareAsync IFileComparison

Compares two or three files. This method is asynchronous (returns before the comparison completes). An event ComparisonComplete is fired when the comparison is finished to report errors and results.

IDL HRESULT CompareAsync(
    [in] VARIANT strFirstFile,
    [in] VARIANT strSecondFile,
    [in, optional] VARIANT strThirdFile)
.NET void CompareAsync(
    Object strFirstFile,
    Object strSecondFile,
    Object strThirdFile)

GiveUserControl ICommonUI

Gives control over the lifetime of the comparison window to the user. Merge will not automatically close the window when outstanding automation references are released.

IDL HRESULT GiveUserControl()
.NET void GiveUserControl()

Print IComparison

Prints the file comparison.

IDL HRESULT Print(
    [in] VARIANT_BOOL bShowPrinterDialog,
    [in] PageOrientation nOrientation)
.NET void Print(
    Boolean bShowPrinterDialog,
    PageOrientation nOrientation)

Refresh IComparison

Recompares the files displayed in the window. This will cause any unsaved changes to be discarded.

IDL HRESULT Refresh()
.NET void Refresh()

Report IComparison

Not currently used.

Report2 IComparison

Not currently used.

Restore ICommonUI

Restores the comparison window from minimized or maximised state to its normal resizable state.

IDL HRESULT Restore()
.NET void Restore()

SaveComparison IComparison

Saves the comparison to a file. We recommend that you use the .cmp7 extension in the filename.

IDL HRESULT SaveComparison(
    [in] BSTR filename)
.NET void SaveComparison(
    String filename)

SaveFile IFileComparison

Not currently used.

SaveFileAs IFileComparison

Not currently used.

SetPanelTitles IComparison

Sets the titles shown above the file panels.

IDL HRESULT SetPanelTitles(
    [in] VARIANT strFirst,
    [in] VARIANT strSecond,
    [in, optional] VARIANT strThird)
.NET void SetPanelTitles(
    Object strFirst,
    Object strSecond,
    Object strThird)

ThreeWayMerge IFileComparison

Not currently used.

Events

Close IFileComparisonEvents

The file comparison window was closed by the user.

IDL HRESULT Close()
.NET void Close()

ComparisonComplete IFileComparisonEvents

Occurs when a file comparison completes. For comparisons between two files, only the first two arguments are defined. For comparisons between three files, all four arguments are defined.

IDL HRESULT ComparisonComplete(
    [in] FileComparisonError error1,
    [in] FileComparisonResult result1,
    [in, optional] FileComparisonError error2,
    [in, optional] FileComparisonResult result2)
.NET void ComparisonComplete(
    FileComparisonError error1,
    FileComparisonResult result1,
    FileComparisonError error2,
    FileComparisonResult result2)