User32CreateIconFromResource Method

Creates an icon or cursor from resource bits describing the icon.

To specify a desired height or width, use the CreateIconFromResourceEx(Byte, UInt32, Boolean, UInt32, Int32, Int32, CreateIconFromResourceFlags) function

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static IntPtr CreateIconFromResource(
	ref byte refResourceBits,
	uint resourceSize,
	bool isIcon,
	uint version
)

Parameters

refResourceBits  Byte
The buffer containing the icon or cursor resource bits.

These bits are typically loaded by calls to the LookupIconIdFromDirectory, LookupIconIdFromDirectoryEx, and LoadResource(SafeModuleHandle, IntPtr) functions.

resourceSize  UInt32
The size, in bytes, of the set of bits pointed to by the refResourceBits parameter.
isIcon  Boolean
Indicates whether an icon or a cursor is to be created.

If this parameter is , an icon is to be created. If it is , a cursor is to be created.

version  UInt32
The version number of the icon or cursor format for the resource bits pointed to by the presbits parameter. The value must be greater than or equal to 0x00020000 (&H20000 in VB.NET) and less than or equal to 0x00030000 (&H30000 in VB.NET). This parameter is generally set to 0x00030000 (&H30000 in VB.NET).

Return Value

IntPtr
If the function succeeds, the return value is a handle to the icon or cursor.

If the function fails, the return value is Zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also