IWiaItem2::CheckExtension method

Checks whether a specified extension is available on the machine and can be used by the IWiaItem2::GetExtension method.

Syntax

HRESULT CheckExtension(
  [in]  LONG   lFlags,
  [in]  BSTR   bstrName,
  [in]  REFIID riidExtensionInterface,
  [out] BOOL   *pbExtensionExists
);

Parameters

lFlags [in]

Type: LONG

Currently unused. Should be set to zero.

bstrName [in]

Type: BSTR

Specifies the name of the extension.

riidExtensionInterface [in]

Type: REFIID

Currently unused.

pbExtensionExists [out]

Type: BOOL*

Receives a pointer to a BOOL.

FALSE

The specified extension is not available.

TRUE

The specified extension is available.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

Using this method, applications can check whether an extension is available before calling the IWiaItem2::GetExtension method. Also, the application can check which extensions are available without co-creating each of them, and then decide which one to use.

Examples

CheckImgFilter checks if the driver has an image processing filter. Before calling into the preview component, an application should ensure that the driver has an image processing filter.

HRESULT
CheckImgFilter(
   IN  IWiaItem2 *pWiaItem2,
   OUT BOOL      *pbHasImgFilter)
{
   HRESULT     hr = S_OK;

   if (!pWiaItem2 || !pbHasImgFilter)
   {
      hr = E_INVALIDARG;
   }

   if (SUCCEEDED(hr))
   {
     *pbHasImgFilter = FALSE;
   }

   if (SUCCEEDED(hr))
   {
      BSTR    bstrFilterString = SysAllocString(WIA_IMAGEPROC_FILTER_STR);

      if (bstrFilterString)
      {
         hr = pWiaItem2->CheckExtension(0,
                                        bstrFilterString,
                                        IID_IWiaSegmentationFilter,
                                        pbHasImgFilter);

         SysFreeString(bstrFilterString);
         bstrFilterString = NULL;
      }
      else
      {
         hr = E_OUTOFMEMORY;
      }
   }

   return hr;

}

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Header
Wia.h
IDL
Wia.idl