次の方法で共有


IXRApplication::AddResourceModule (Windows Embedded CE 6.0)

1/6/2010

This method adds this module for Silverlight 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 Silverlight will use to resolve image sources by exact name, with type=XAML_RESOURCE.

Return Value

Returns an HRESULT that indicates success or failure.

Remarks

Silverlight 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, Silverlight will search linearly through its internal collections when it resolves resources.

This method is helpful if you expect Silverlight 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 2 XAML solution to Silverlight on Windows Embedded CE. With a resource module, these types of image resources will automatically be resolved at run time.

Silverlight will automatically resolve images using the Windows Embedded CE Imaging component, SYSGEN_IMAGING. Make sure to include the SYSGEN variables in your OS design that support the format that you want Silverlight to automatically resolve, such as SYSGEN_IMAGING_BMP_DECODE, SYSGEN_IMAGING_BMP_ENCODE, and so on. For more information, see Imaging OS Design Development.  

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 Silverlight 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
Windows Embedded CE Windows Embedded CE 6.0 R3

See Also

Reference

IXRApplication
IXRApplication::RemoveResourceModule