Share via


IXRApplication::AddResourceModule (Compact 2013)

3/28/2014

This method adds this module for XAML for Windows Embedded to use when it automatically resolves Image Source URIs as presented in the source XAML.

Syntax

virtual HRESULT STDMETHODCALLTYPE AddResourceModule(
    HINSTANCE hInstResource
) = 0;

Parameters

  • hInstResource
    [in] HINSTANCE that XAML for Windows Embedded will use to resolve image sources by exact name, with type=XAML_RESOURCE.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

XAML for Windows Embedded will use the hInstResource resource binary to search for image resources that are both specified in source XAML and defined in the resource binary. If multiple resource libraries are added by calling this method, XAML for Windows Embedded will search linearly through its internal collections when it resolves resources.

This method is helpful if you expect XAML for Windows Embedded application to load a resource from a resource binary (DLL or EXE), instead of from the URI of a relative path. This is common when you are porting a desktop Microsoft Silverlight 3 XAML solution to XAML for Windows Embedded on Windows Embedded Compact. With a resource module, these types of image resources will automatically be resolved at run time.

XAML for Windows Embedded will automatically resolve images using the Windows Embedded Compact Imaging component, SYSGEN_IMAGING. Make sure to include the SYSGEN variables in your OS design that support the format that you want XAML for Windows Embedded to automatically resolve, such as SYSGEN_IMAGING_BMP_DECODE, SYSGEN_IMAGING_BMP_ENCODE, and so on..

If you use this approach, you do not need to register a resource manager by calling IXRApplication::RegisterResourceManager.

You can specify the image sources for your application in a resource file (.rc file) by using the type XAML_RESOURCE. This type indicates to XAML for Windows Embedded that its source image must be resolved automatically at run time. For example:

Image7.jpg    XAML_RESOURCE      DISCARDABLE  "Image7.jpg"
Image8.jpg    XAML_RESOURCE      DISCARDABLE  "Image8.jpg"

.NET Framework Equivalent

None.

Requirements

Header

XamlRuntime.h

sysgen

SYSGEN_XAML_RUNTIME

See Also

Reference

IXRApplication
IXRApplication::RemoveResourceModule