Help Center

AfxGdipIconFromResfunction

Loads an image from a resource, converts it to an icon and returns the handle.

GraphicsfunctionAfxGdiPlus.incdocumented

Syntax

FUNCTION AfxGdipIconFromRes (BYVAL hInstance AS HINSTANCE, BYREF wszImageName AS WSTRING, BYVAL dimPercent AS LONG = 0, BYVAL bGrayScale AS LONG = FALSE) AS HANDLE

Parameters

NameDescription
hInstanceA handle to the module whose portable executable file or an accompanying MUI file contains the resource. If this parameter is NULL, the function searches the module used to create the current process.
wszImageNameName of the image in the resource file (.RES). If the image resource uses an integral identifier, wszImage should begin with a number symbol (#) followed by the identifier in an ASCII format, e.g., "#998". Otherwise, use the text identifier name for the image. Only images embedded as raw data (type RCDATA) are valid. These must be icons in format .png, .jpg, .gif, .tiff.
dimPercentOptional. Percent of dimming (1-99).
bGrayScaleOptional. TRUE or FALSE. Convert to gray scale.

Return value

If the function succeeds, the return value is the handle of the created icon.

If the function fails, the return value is NULL.

Description

Loads an image from a resource, converts it to an icon and returns the handle.

Reference

  • Include file AfxGdiPlus.inc
  • Defined in AfxNova/AfxGdiPlus.inc:792
  • Documented in Graphics/GdiPlus Classes/GdiPlus Procedures.md
  • Topic: GdiPlus Procedures