The UpdateResource function adds, deletes, or replaces a resource in an executable file.
BOOL UpdateResource(
HANDLE hUpdate, // update-file handle
LPCTSTR lpType, // address of resource type to update
LPCTSTR lpName, // address of resource name to update
WORD wLanguage, // language identifier of resource
LPVOID lpData, // address of resource data
DWORD cbData // length of resource data, in bytes
);
Value | Meaning |
---|---|
RT_ACCELERATOR | Accelerator table |
RT_ANICURSOR | Animated cursor |
RT_ANIICON | Animated icon |
RT_BITMAP | Bitmap resource |
RT_CURSOR | Hardware-dependent cursor resource |
RT_DIALOG | Dialog box |
RT_FONT | Font resource |
RT_FONTDIR | Font directory resource |
RT_GROUP_CURSOR | Hardware-independent cursor resource |
RT_GROUP_ICON | Hardware-independent icon resource |
RT_HTML | HTML document |
RT_ICON | Hardware-dependent icon resource |
RT_MENU | Menu resource |
RT_MESSAGETABLE | Message-table entry |
RT_RCDATA | Application-defined resource (raw data) |
RT_STRING | String-table entry |
RT_VERSION | Version resource |
If lpData is NULL, the specified resource is deleted from the executable file.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
An application can use UpdateResource repeatedly to make changes to the resource data. Each call to UpdateResource contributes to an internal list of additions, deletions, and replacements but does not actually write the data to the executable file. The application must use the EndUpdateResource function to write the accumulated changes to the executable file.
Windows NT: Requires version 3.1 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Resources Overview, Resource Functions, BeginUpdateResource, EndUpdateResource, LoadIcon, LoadString, LockResource, MAKEINTRESOURCE, MAKELANGID, SizeofResource