Help Center

AfxExtractResourceToFilefunction

Extracts resource data and saves it to a file.

WindowsfunctionAfxWin.incdocumented

Syntax

FUNCTION AfxExtractResourceToFile (BYVAL hInstance AS HINSTANCE, BYREF wszResourceName AS WSTRING, BYREF wszFileName AS WSTRING, BYVAL pResourceType AS LPWSTR = MAKEINTRESOURCEW(10)) AS STRING

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.
wszResourceNameName of the resource. If the resource is an image that uses an integral identifier, wszResourceName 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 in format .png, .jpg, .gif, .tiff.
wszFileNamePath of the file where to save the extracted resource.
pResourceTypeType of the resource, e.g. RT_RCDATA. For a list of predefined resource types see: Resource Types

Return value

TRUE on success of FALSE on failure.

Description

Extracts resource data and saves it to a file.

Examples

AfxExtractResourceToFile(NULL, "IDI_ARROW_RIGHT", "IDI_ARROW_RIGHT.png") where IDI_ARROW_RIGHT is the identifier in the resource file for IDI_ARROW_RIGHT RCDATA ".\Resources\arrow_right_64.png"

AfxExtractResourceToFile(NULL, "#111", "VEGA_PAZ_01.jpg") where "#111" is the identifier in the resource file for 111 RCDATA ".\Resources\VEGA_PAZ_01.jpg"

Reference

  • Include file AfxWin.inc
  • Defined in AfxNova/AfxWin.inc:1488
  • Documented in Windows/Windows Procedures.md
  • Topic: Windows Procedures