Skip to content

Latest commit

 

History

History
186 lines (150 loc) · 7.43 KB

nf-libloaderapi-findresourcew.md

File metadata and controls

186 lines (150 loc) · 7.43 KB
UID tech.root title ms.date targetos description req.assembly req.construct-type req.ddi-compliance req.dll req.header req.idl req.include-header req.irql req.kmdf-ver req.lib req.max-support req.namespace req.redist req.target-min-winverclnt req.target-min-winversvr req.target-type req.type-library req.umdf-ver req.unicode-ansi topic_type api_type api_location api_name f1_keywords dev_langs
NF:libloaderapi.FindResourceW
menurc
FindResourceW
04/19/2021
Windows
Determines the location of a resource with the specified type and name in the specified module. (FindResourceW)
function
Kernel32.dll
libloaderapi.h
Windows.h
Kernel32.lib
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
Windows
apiref
DllExport
Kernel32.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-0.dll
kernel32legacy.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-1.dll
API-MS-Win-Core-Kernel32-Legacy-l1-1-2.dll
API-MS-Win-DownLevel-Kernel32-l2-1-0.dll
API-MS-Win-Deprecated-APIs-Legacy-l1-1-0.dll
API-MS-Win-Core-Libraryloader-l1-2-1.dll
KernelBase.dll
MinKernelBase.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-3.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-4.dll
API-MS-Win-Core-Kernel32-Legacy-L1-1-5.dll
API-MS-Win-Core-LibraryLoader-L1-2-2.dll
FindResourceW
FindResource
FindResourceW
libloaderapi/FindResourceW
FindResource
libloaderapi/FindResource
c++

FindResourceW function

-description

Determines the location of a resource with the specified type and name in the specified module.

To specify a language, use the FindResourceEx function.

-parameters

-param hModule [in, optional]

Type: HMODULE

A handle to the module whose portable executable file or an accompanying MUI file contains the resource. If this parameter is NULL, the function searches the module used to create the current process.

-param lpName [in]

Type: LPCTSTR

The name of the resource. Alternately, rather than a pointer, this parameter can be MAKEINTRESOURCE(ID), where ID is the integer identifier of the resource. For more information, see the Remarks section below.

-param lpType [in]

Type: LPCTSTR

The resource type. Alternately, rather than a pointer, this parameter can be MAKEINTRESOURCE(ID), where ID is the integer identifier of the given

resource type. For standard resource types, see Resource Types. For more information, see the Remarks section below.

-returns

Type: HRSRC

If the function succeeds, the return value is a handle to the specified resource's information block. To obtain a handle to the resource, pass this handle to the LoadResource function.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

-remarks

If IS_INTRESOURCE is TRUE for x = lpName or lpType, x specifies the integer identifier of the name or type of the given resource. Otherwise, those parameters are long 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 a resource, an application should refer to it by integer identifier instead of by name.

An application can use FindResource to find any type of resource, but this function should be used only if the application must access the binary resource data by making subsequent calls to LoadResource and then to LockResource.

To use a resource immediately, an application should use one of the following resource-specific functions to find the resource and convert the data into a more usable form.

Function Action
FormatMessage Loads and formats a message-table entry.
LoadAccelerators Loads an accelerator table.
LoadBitmap Loads a bitmap resource.
LoadCursor Loads a cursor resource.
LoadIcon Loads an icon resource.
LoadMenu Loads a menu resource.
LoadString Loads a string-table entry.

For example, an application can use the LoadIcon function to load an icon for display on the screen. However, the application should use FindResource and LoadResource if it is loading the icon to copy its data to another application.

String resources are stored in sections of up to 16 strings per section. The strings in each section are stored as a sequence of counted (not necessarily null-terminated) Unicode strings. The LoadString function will extract the string resource from its corresponding section.

Examples

For an example, see Updating Resources.

-see-also

Conceptual

FindResourceEx
FormatMessage
IS_INTRESOURCE
LoadAccelerators
LoadBitmap
LoadCursor
LoadIcon
LoadMenu
LoadResource
LoadString
LockResource

Other Resources

Reference

Resources
SizeofResource