For QuickTest to recognize the COM object that you create as a custom comparer, you must register it to the component category for QuickTest bitmap comparers.

Your register a COM object to a component category by listing the relevant component category ID as a registry key under the COM object’s HKEY_CLASSES_ROOT\CLSID\<Object’s CLSID>\Implemented Categories key.

The component category ID must be registered under the HKEY_CLASS_ROOT\Component Categories key. When QuickTest is installed, it adds the component category ID for QuickTest bitmap comparers as a registry key in this location.

The component category ID for QuickTest bitmap comparers, CATID_QTPBitmapComparers, is defined in <QuickTest installation folder>\dat\BitmapCPCustomization\ComponentCategory.h.

 

Setting the Custom Comparer Name

The name that QuickTest uses is the value (in the registry) of the default property of the custom comparer ProgID key under the HKEY_CLASSES_ROOT key.

 

The CompareBitmaps Method

Syntax:

HRESULT CompareBitmaps ([in] IPictureDisp* pExpected,

       [in] IPictureDisp* pActual,

       [in] BSTR bstrConfiguration,

       [out] BSTR* pbstrLog,

       [out] IPictureDisp** ppDiff,

       [out, retval] VARIANT_BOOL* pbMatch);

pbMatch. A Boolean value (output)

Possible values:

VARIANT_TRUE. Actual and expected bitmaps match, checkpoint passed.

VARIANT_FALSE. Actual and expected bitmaps do not match, checkpoint fails.

 

Return Value

The HRESULT that this method returns indicates whether the comparison ran successfully (and not whether the bitmaps match).

 

The GetDefaultConfigurationString Method

The GetDefaultConfigurationString method must return the default configuration string for your custom comparer.

Syntax:

HRESULT GetDefaultConfigurationString ([out, retval] BSTR* pbstrConfiguration);

 

The GetHelpFilename Method

The GetHelpFilename method must return a path to the documentation that contains information about your custom comparer for QuickTest users.

The path can be one of the following:

  • A full path to a file.
  • A relative path to a file (QuickTest searches for this path relative to <QuickTest installation folder>\bin).
  • A URL.

If you do not provide documentation for your custom comparer, this method should return the HRESULT E_NOTIMPL.

Syntax:

HRESULT GetHelpFilename ([out, retval] BSTR* pbstrFilename);

 

P1616    Creating a Custom Comparer in C++ using Microsoft Visual Studio