IXRApplication::LoadImageFromResource (Compact 2013)

3/28/2014

This method loads a bitmap image from a binary resource and creates an IWICBitmap object for the resource manager to use.

Syntax

virtual HRESULT STDMETHODCALLTYPE LoadImageFromResource(
    HINSTANCE    hInstResource,
    const WCHAR* pResourceName,
    const WCHAR* pResourceType,
    IWICBitmap** ppImage
) = 0;

Parameters

  • hInstResource
    [in] Handle to the instance of the binary module that contains the resource to be loaded. For more information, see the Remarks section.
  • pResourceName
    [in] Pointer to a string that contains the ID of the resource to load. If you have an integer value, you can convert it to a resource type by using the MAKEINTRESOURCE macro; for example, MAKEINTRESOURCE(IDB_BACKGROUND).
  • pResourceType
    [in] Pointer to a string that describes the type of resource as compiled into the resources section of the binary. This can be one of the following:

    Image file type

    pResourceType value

    .gif file

    L"GIF"

    .jpg file

    L"JPG"

    .png file

    L"PNG"

    .bmp file

    Value that you used in the .rc file for your bitmap image. For example, specify L"RAW_BITMAP" for a bitmap defined in the .rc file as follows:

    ID_RAW_BMP_TEST RAW_BITMAP DISCARDABLE "xaml\\image.bmp"

    Do not use L"BITMAP".

    This value is used internally in calls to FindResource and LoadResource.

  • ppImage
    [out] Pointer to an IWICBitmap object that provides programmatic access to the bitmap image.

Return Value

An HRESULT returns S_OK if succesful; otherwise, returns a non-zero error code.

Remarks

In Win32, HINSTANCE and HMODULE both basically refer to a handle to a module. HINSTANCE originates from 16-bit Windows programming and persists for continuity between 16-bit Windows and Win32. Most Win32 APIs can accept either an instance handle (HINSTANCE) or a module handle (HMODULE).

In LoadImageFromResource, hInstResource refers to the current execution context of the module that contains the resources, such as bitmaps, that you want to load. Multiple instances of a module can run at one time. By using hInstResource to reference the module instance, resources loaded by this method can be freed internally by the application instance when it shuts down.

XAML for Windows Embedded handles the drawing operation for the bitmap image in ppImage.

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRApplication