FindResourceEx

  HRSRC FindResourceEx(hModule, lpszType, lpszName, wLanguage)    
  HANDLE hModule; /* module containing resources */
  LPCTSTR lpszType; /* resource type */
  LPCTSTR lpszName; /* resource name */
  WORD wLanguage; /* resource language */

The FindResourceEx function determines the location of a resource in the specified resource file.

Parameters

hModule

Identifies the module whose executable file contains the resource. If this parameter is NULL, the function searches the image file that was used to create the current process.

lpszType

Points to a null-terminated string that specifies the type name of the resource. For predefined resource types, this parameter should be one of the following values:

Value Meaning

RT_ACCELERATOR Accelerator table
RT_BITMAP Bitmap resource
RT_DIALOG Dialog box
RT_FONT Font resource
RT_FONTDIR Font directory resource
RT_MENU Menu resource
RT_RCDATA User-defined resource (raw data)
RT_STRING String-table entry
RT_MESSAGETABLE Message-table entry
RT_CURSOR Hardware-dependent cursor resource
RT_GROUP_CURSOR Hardware-independent cursor resource
RT_ICON Hardware-dependent icon resource
RT_GROUP_ICON Hardware-independent icon resource
RT_VERSION Version resource

lpszName

Points to a null-terminated string that specifies the name of the resource.

wLanguage

Specifies the language of the resource. If this parameter is MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL) then the current language associated with the calling thread is used.

To specify a language other than the current language, use the MAKELANGID macro to create this parameter.

Return Value

If the function is successful, the return value is a handle to the specified resource. Otherwise, the return value is NULL. Use the GetLastError function to obtain extended error information.

Comments

If the high word of the lpszType or lpszName parameter is zero, the low word specifies the integer identifier of the type or name of the given resource. Otherwise, the parameters are pointers to null-terminated strings. If the first character of the string is a pound sign (#), the remaining characters represent a decimal number that specifies the integer identifier of the resource's name or type. For example, the string “#258” represents the integer identifier 258.

To reduce the amount of memory required for the resources used by an application, applications should refer to their resources by integer identifier instead of by name.

An application should not use the FindResource, FindResourceEx, and LoadResource functions to load cursor, icon, string or message-string resources, unless it needs access to the binary resource data. Instead, it should load these resources by calling the following functions:

LoadCursor

LoadIcon

LoadString

FormatMessage

An application can use the FindResource, FindResourceEx, and LoadResource functions to load other predefined resource types. However, it is recommended that the application load the corresponding resources by calling the following functions:

LoadAccelerators

LoadBitmap

LoadMenu

The FindResourceEx function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).

See Also

FindResource, LoadResource, MAKELANGID