Function LoadResource() Foundation
Loads a resource from a linked resource file or from a DLL.
LoadResource( <nResId>|<cResId>, [<nDll|cDll>], [<nRestype>|<cResType>], <nLanguageId|cLanguageId> ) --> xResource
|XPP_MOD_EXE *)||The current EXE file|
|XPP_MOD_NLS||The Xbase++ nation DLL XppNat.dll|
|XPP_MOD_RT1||The Xbase++ runtime DLL XppRt1.dll|
|XPP_MOD_UI1||The Xbase++ runtime DLL XppUi1.dll|
|XPP_MOD_UI2||The Xbase++ runtime DLL XppUi2.dll|
The function returns the content of the requested resource. If the resource could not be found, NIL will be returned. The error condition can be determined using DosError().
|RES_STRING||C||String resource as CHARACTER converted to the current CHARSET coding|
|RES_RAWSTRING||C||String resource as CHARACTER not converted|
|RES_VERSION||A||Version information in a two-dimensional ARRAY|
|RES_VERSIONFIXED||A||fixed version information in a one-dimensional ARRAY|
|<userdef>||C||data as defined in the resource file|
LoadResource() loads resource data created using a resource compiler like ARC.EXE and that is linked to the main executable file (EXE) or a dynamic library (DLL). If resources of a DLL are to be loaded, the DLL must already be accessible, either by linking the DLL to the main executable file or by loading the DLL using the DllLoad() function.
The main reason for storing data in resource files rather than hardcoding them in application's code is that the application can be configured later without the need to recompile and link. An example for this is multiple-language support. Another reason is to be able to request data from the application without running it, or simply to be able to deliver all required data within one single file.
If a version resource is requested the resource identifier is assumed to be numeric 1 because there is only one VERSION resource allowed per file. If <nResId> equals to RES_VERSION the return value is a two-dimensional array. The sub-arrays have the following string elements:
|RES_VERSION_KEY||version key name as CHARACTER|
|RES_VERSION_VALUE||version value as CHARACTER|
If RES_VERSIONFIXED is requested, the one-dimensional array consists of numeric elements. The sole purpose of having the version numbers as numerical values is to be able to safely compare the values for a version check.
|RES_PRODVER_LS||lower 32 bit of the product version number|
|RES_PRODVER_MS||higher 32 bit of the product version number|
|RES_FILEVER_LS||lower 32 bit of the file version number|
|RES_FILEVER_MS||higher 32 bit of the file version number|
|RES_FILETIME_LS||lower 32 bit of the file time|
|RES_FILETIME_MS||higher 32 bit of the file time|
For an explanation of the VERSION resource, see Alaska Resource Compiler.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.