AccessResource

Syntax

int AccessResource(hInstance,hResInfo)

This function opens the specified resource file and moves the file pointer to the begin-ning of the specified resource, letting an application read the resource from the file. The AccessResource function supplies a DOS file handle that can be used in subsequent file-read calls to load the resource. The file is opened for reading only.

Applications that use this function must close the resource file by calling the _lclose function after reading the resource.

Parameter Type/Description  

hInstance HANDLE Identifies the instance of the module whose executable file contains the resource.  
hResInfo HANDLE Identifies the desired resource. This handle should be created by using the FindResource function.  

Return Value

The return value specifies a DOS file handle to the designated resource file. It is –1 if the resource cannot be found.

Comments

AccessResource can exhaust available DOS file handles and cause errors if the opened file is not closed after the resource is accessed.