Windows Embedded CE6 R3 released including Silverlight for Windows Embedded


The project I've been working on since my last blog posts has finally been released!  There is some fantastic documentation out on MSDN that can get you familiar with the new Silverlight for Windows Embedded API and how to create applications: Silverlight for Windows Embedded on MSDN


The first thing you might wonder is how to create an application that uses this new api.  There's an MSDN page for that: http://msdn.microsoft.com/en-us/library/ee503558.aspx, but I thought I would start out by showing some code that I've used when creating applications.  This uses all the functions detailed on MSDN.


INT WINAPI WinMain(
    HINSTANCE hInstance, 
    HINSTANCE hPrevInstance, 
    LPWSTR lpCmdLine, 
    int nCmdShow
    )
{
    int             exitCode = -1;
    HRESULT         hr = S_OK;
 
    XamlRuntimeManager xr;
 
    if(xr.IsInitialized())
    {
        if(SUCCEEDED(DoSomethingHere(lpCmdLine)))
        {
            exitCode = 0;
        }
    }
 
    return exitCode;
}
 

The main thing to notice here is the XamlRuntimeManager, this does all the initilization for you.  Lets take a look at what that class does.


//this class will initialize and uninitialize XamlRuntime
//
class XamlRuntimeManager
{
private:
    BOOL m_IsInitialized;
 
public:
    XamlRuntimeManager()
    {
        m_IsInitialized = XamlRuntimeInitialize();
    }
 
    ~XamlRuntimeManager()
    {
        if(m_IsInitialized)
        {
            XamlRuntimeUninitialize();
        }
    }
 
    BOOL IsInitialized() { return m_IsInitialized; }
 
};
 
If you want to see this code in action it is in one of the sample applications that has shipped with R3, XamlPerf.

Comments (4)
  1. Winter says:

    Hi Brett, have you successfully created objects in C++, using CreateObject, and added them to the visual tree? I need to be able to do this, without using XAML, and I cannot get simple objects like Line, Ellipse, Rectangle to display (but Button and TextBlock do).

    Any advice would be greatly appreciated.

    Thanks,

    Winter

    winterene@yahoo.com

  2. shaihi says:

    Embedded Silverlight is an enormous addition to Windows Embedded CE. Congrats on accomplishing this.

    However, I would like to see more complex examples by Microsoft out there.

    Thanks,

    Shai

  3. Hi Shai – what kind of examples are you interested in?  I would be glad to provide an example that is more complicated.  

    Brett

  4. Carlo Marco says:

    Hi Brett, perhaps some example about serial I/O via Rs-232 ?  ….

Comments are closed.

Skip to main content