LOADRESOURCE

Top  Previous  Next

Syntax

INT = LOADRESOURCE(identifier, type, var)

Description

Loads a resource from the executable and places either a copy of the resource, or an integer pointer to the resource, in the variable specified.

Parameters

identifier - Resource name or numeric identifier.

type - Type name or numeric identifier.

var - STRING, INT, UINT, POINTER or MEMORY variable to store the resource contents.

Return value

Returns 0 on failure, 1 on success.

Remarks

If var is a STRING (or ISTRING) variable the contents of the resource will be copied into the string. Useful for embedded text resources.

 

If var is an INT / UINT variable then a handle to the locked resource is returned. Useful for API calls.

 

If var is a MEMORY variable then memory is allocated for the resource and resource copied into the memory. You can then use READMEM to read the resource data. LEN(variable) will return the length of the resource in this case. You must free the memory returned with the FREEMEM statement. Using a MEMORY variable that has been allocated with ALLOCMEM will result in memory leaks in your program.

If var is a POINTER then a pointer to the locked resource is returned. You can read the resource using standard type casting.

The standard windows resource types can be loaded by specifying one of the following for the type parameter:

@RESCURSOR

@RESBITMAP

@RESICON

@RESMENU

@RESDIALOG

@RESSTRING

@RESACCEL

@RESDATA

@RESMESSAGETABLE

@RESGROUPCURSOR

@RESGROUPICON

@RESVERSION

See Also: LOADIMAGE, LOADMENU

Example usage

IF LOADRESOURCE("mydata",@RESDATA,pData)
  PRINT #<UINT>pData
ENDIF