SetResourceHandler

Syntax

FARPROC SetResourceHandler(hInstance,lpType,lpLoadFunc)

This function sets up a function to load resources. It is used internally by Windows to implement calculated resources. Applications may find this function useful for handling their own resource types, but its use is not required. The lpLoadFunc parameter points to an application-supplied callback function. The function pointed to by the lpLoadFunc parameter receives information about the resource to be locked and can process that information as desired. After the function pointed to by lpLoadFunc returns, LockResource attempts to lock the resource once more.

Parameter Type/Description  

hInstance HANDLE Identifies the instance of the module whose executable file contains the resource.  
lpType LPSTR Points to a short integer that specifies a resource type.  
lpLoadFunc FARPROC Is the procedure-instance address of the application-supplied callback function. See the following “Comments” section for details.  

Return Value

The return value points to the application-supplied function.

Comments

The callback function must use the Pascal calling convention and must be declared FAR.

Callback Function

FARPROC FAR PASCAL LoadFunc(hMem, hInstance, hResInfo)
HANDLE hMem;
HANDLE hInstance;
HANDLE hResInfo;

LoadFunc is a placeholder for the application-supplied function name. The actual name must be exported by including it in an EXPORTS statement in the application's module-definition file.

Parameter Description  

hMem Identifies a stored resource.  
hInstance Identifies the instance of the module whose executable file contains the resource.  
hResInfo Identifies the resource. It is assumed that the resource was created previously by using the FindResource function.  

Comments

The hMem parameter is NULL if the resource has not yet been loaded. If an attempt to lock a block specified by hMem fails, this means the resource has been discarded and must be reloaded.

The dialog-function address, passed as the lpLoadFunc parameter, must be created by using the MakeProcInstance function.