IWiaUIExtension::GetDeviceIcon method

The IWiaUIExtension::GetDeviceIcon method gets a custom device icon.

Syntax

HRESULT GetDeviceIcon(
  [in]  BSTR  bstrDeviceId,
  [out] HICON *phIcon,
        ULONG nSize
);

Parameters

  • bstrDeviceId [in]
    Specifies the device ID of the WIA device for which the icon is to be obtained. For more information about WIA device IDs, see WIA_DIP_DEV_ID.

  • phIcon [out]
    Points to a memory location that will receive a handle for the icon for the device.

  • nSize
    Specifies the desired icon size, in pixels. The icon is assumed to be square, and nSize specifies both the width and height of the requested icon.

Return value

If the method succeeds, it returns S_OK. If the method fails, it returns a standard COM error code.

Remarks

The application can supply any icon size for the nSize parameter. The driver can do any of the following, listed from most to least desirable:

  • Use LoadImage to load an icon of the size requested in the nSize parameter.

  • Refuse to provide the size indicated in the nSize parameter by returning E_NOTIMPL.

  • Provide a standard-sized icon and ignore the nSize parameter.

After you load the icon, use CopyIcon to make a copy of the icon, and place the copy's handle in *phIcon. Doing this ensures that the icon resource remains valid after the DLL containing the resource is unloaded. It is the responsibility of the caller of the IWiaUIExtension::GetDeviceIcon method to release the copied icon using DestroyIcon.

Requirements

Target platform

Desktop

Version

Available in Windows Me and in Windows XP and later versions of the Windows operating systems.

Header

Wiadevd.h (include Wiadevd.h)

 

 

Send comments about this topic to Microsoft