The Imagine Cup 2009 competition starts in roughly two days – one part of the evnet is the Embedded Development competition – our roving reporter Olivier Bloch (see photo below) will be on-site working as a judge for the embedded competition. I expect Olivier will be blogging highlights from each day – check Olivier’s blog for more information.

- Mike
The CE 6.0 development tools are designed/tested on 32-bit Windows (Windows XP, Windows Vista) – I’ve been using the CE 6.0 development tools on 32-bit Windows 7 for some time without any issues.
I recently paved my development PC (quad-core, x64, 8GB RAM, 2TB H/D) and decided to install 64-bit Windows 7. The installation process for all of the development tools (VS 2005, CE 6.0, VS 2008, VS 2010 CTP) seemed to go smoothly, but…
Last week I create a new OSDesign for a CE 6.0 operating system configuration, the wizards all worked well and I ended up with a new OSDesign in the CE 6.0 tools. The operating system image didn’t build though – I got an error that stated “Tools Install Dir in registry is missing.”
I checked with the CE 6.0 tools team – The CE 6.0 tools are not supported on 64-bit Windows.
There are two solutions to this problem, one immediate (but perhaps not ideal), and one longer term – first the immediate solution.
- Install the CE 6.0 tools on a 32-bit Windows operating system (Windows XP, Windows Vista, Windows 7 32-bit)
- Install the CE 6.0 tools in a Virtual PC image, this would allow a Virtual PC/CE 6.0 tools environment to run on a 64-bit Windows image.
We are working on a longer term solution to the problem that would allow you to work with CE 6.0 operating system images on 64-bit systems.
- Mike
Microsoft Robotics Developer Studio 2008 R2 is now released.
More information, and download available here
- Mike
Here’s some background reading before we get into the rest of the blog post.
Here’s the cunning plan – you could imagine building a digital picture frame or other type of device that may expose a remote administration user interface through your desktop web browser. In the case of the picture frame you might want to set the RSS feed name that the frame is consuming, or if the device is on a corporate domain network then you might want to set the proxy settings, image transition times, or some other setting for the device.
I recently built a CE 6.0 R2 operating system image for a digital picture frame that exposed some simple console applications through a Telnet interface to configure feeds and stuff, perhaps this method is ok for some users but not ideal for the majority of users who would be far more comfortable using Internet Explorer.
The Windows CE web server (SYSGEN_HTTPD) does support ASP pages (not ASP.NET, just raw ASP), and also supports ISAPI extensions (the SOAP server is a good example of an ISAPI extension), I’m not sure that I want to do raw ASP work, I’d much prefer to build the web UI using Microsoft Expression Blend and then code behind the user experience with C#.
Note that if I build a Silverlight 2.0 application and host this on my Windows CE device that the web application runs in the context of my desktop web browser, not on the Windows CE device. If we need to change settings on the Windows CE device then we will need to expose some kind of interface for the Silverlight application to call into.
CE 6.0 ships with a SOAP server (hosted by the HTTPD web server [which is about 80kb]), creating a native code XML Web Service is fairly straight forward – You write the XML Web Service as a C++ ATL/COM object which is hosted by the SOAP server running on Windows CE. Part of the process of generating the XML Web Service is to generate the WSDL (Web Service Description Language) and WSML (Web Service Meta Language) that link exposed XML Web service functions to the interface ID of the COM object.
Windows CE XML Web Services are bound to RPC style binding and encoded use model. Silverlight 2.0 doesn’t directly support the RPC/Encoded binding/use model, but does support RPC/Literal – so, we have a mismatch. If the CE SOAP model was RPC/Literal then we would be able to directly import the WSDL to the Silverlight project (Add Service Reference) and have a proxy class built for us that would make it super easy to call into the Windows CE exposed web service. Interestingly, desktop C# applications can import/call RPC/Encoded web services.
Silverlight 2.0 does support the ability to manually generate an HTTP POST which is all that’s really needed to call a SOAP service. In this case all I really need to know is what the HTTP POST packet needs to look like. Once I know the HTTP POST structure I can then either manually deconstruct WSDL to HTTP POST, or perhaps write a utility that could import WSDL and spit out Silverlight 2.0 C# code to make the SOAP call. For this exercise I did the manual process of deconstructing WSDL to code.
One way to figure this out is to write a desktop C# application that imports the CE 6.0 WSDL, generates the proxy classes, and then actually call the Windows CE SOAP service. Once you call the SOAP service you can set a breakpoint in the HTTPD web server and look at the inbound message.
If you have the CE 6.0 Shared Source installed take a look at the following file…
\Wince600\private\servers\httpd\Core\Request.cpp – Line 49 (function CHttpRequest::HandleRequest).
When the breakpoint fires, examine the contents of m_bufRequest.m_pszBuf – this contains the inbound message.
My XML Web Service is called WsString – this exposes one function called PassString – the function takes one parameter of type BSTR called MyString.
Here’s the code for the function – nothing interesting to see here, the function simply displays a MessageBox on the Windows CE device, but could easily do anything else on the operating system since the SOAP/XML Web Service is running in user mode, you have access to all of the Windows CE APIs (depending on what’s included in your image).
STDMETHODIMP CStringTest::PassString(BSTR MyString)
{
TCHAR *tcString;
USES_CONVERSION;
tcString = OLE2T(MyString);
MessageBox(NULL,tcString,L"StringTesT",MB_OK);
return S_OK;
}
I set a breakpoint in the HTTPD Web Server code and called my XML Web Service from a desktop C# application – here’s what the HTTP POST looked like.
POST /wsstring.wsdl HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://tempuri.org/action/StringTest.PassString"
Host: 157.56.184.113
Content-Length: 369
Expect: 100-continue
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><q1:PassString xmlns:q1="http://tempuri.org/message/"><MyString xsi:type="xsd:string">Foo</MyString></q1:PassString></s:Body></s:Envelope>
There are a few interesting things to take out from the HTTP POST.
- Notice on the first line the path to the XML Web Services WSDL, and the name of the WSDL (wsstring.wsdl)
- The custom header – SOAPAction
- The SOAP envelope
The interesting part of the SOAP envelope is this…
<q1:PassString xmlns:q1="http://tempuri.org/message/">
<MyString xsi:type="xsd:string">Foo</MyString>
</q1:PassString>
Notice the function name “PassString”, the parameter name “MyString” (type xsd:string), and the actual string being passed “Foo”.
We now have everything we need to call our SOAP service from the Silverlight 2.0 application!
Here’s my amazing Silverlight 2.0 application user interface.

The textBox is rotated and is still completely functional, I can type/edit the contents of the textBox.
In order to call the SOAP service running on the Windows CE device we need to know the host IP address of the device – I covered this in a recent article SL2, calling the CE host
Here’s the code to call the Windows CE SOAP/XML Web Service – there are some interesting things to pull out of the code, see below.
private String soap = @"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body s:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><q1:PassString xmlns:q1=""http://tempuri.org/message/""><MyString xsi:type=""xsd:string"">Foo</MyString></q1:PassString></s:Body></s:Envelope>";
private void Button_Click(object sender, RoutedEventArgs e)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri(HostAddress + "/wsstring.wsdl", UriKind.Absolute));
request.ContentType = "text/xml; charset=utf-8";
request.Accept = "text/xml";
request.Method = "POST";
request.Headers["SOAPAction"] = "\"http://tempuri.org/action/StringTest.PassString\"";
request.BeginGetRequestStream(new AsyncCallback(RequestReady), request);
}
// Sumbit the Post Data
void RequestReady(IAsyncResult asyncResult)
{
HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;
Stream stream = request.EndGetRequestStream(asyncResult);
this.Dispatcher.BeginInvoke(delegate()
{
StreamWriter writer = new StreamWriter(stream);
writer.WriteLine(soap);
writer.Flush();
writer.Close();
request.BeginGetResponse(new AsyncCallback(ResponseReady), request);
});
}
// Get the Result
void ResponseReady(IAsyncResult asyncResult)
{
HttpWebRequest request = asyncResult.AsyncState as HttpWebRequest;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
this.Dispatcher.BeginInvoke(delegate()
{
Stream responseStream = response.GetResponseStream();
StreamReader reader = new StreamReader(responseStream);
// get the result text
string result = reader.ReadToEnd();
tb1.Text = result;
});
}
- I’m passing the SOAP envelope “as is”, unmodified from the original SOAP envelope generated from my desktop C# application – this would be easy to modify to allow me to pass the contents of my amazing UI textBox, or some other data.
- Notice the setup of the WebRequest – I pass the hostaddress and the path to the wsdl
- Notice the setup for ContentType (text/xml) and Method (POST)
- Notice the SOAPAction is being passed as a header, not as the body of the post.
- The only content being passed in the body of the POST is the SOAP envelope.
And here’s the proof that the SOAP service is getting called from the Silverlight 2.0 application, hosted on the Windows CE HTTPD Web Server, and running in the context of my desktop Internet Explorer application (running on Windows 7 RC).

[UPDATE] – I forgot one thing… Your device/service needs to “opt in” to Silverlight cross domain security policies. This is fairly straight forward, you need a file called clientaccesspolicy.xml in the root folder of your HTTPD web server (exposed through \windows\www\wwwpub in the Windows CE file system). Here’s a sample clientaccesspolicy.xml file.
<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
More information on Silverlight 2.0 and making services available across domain boundaries can be found in this MSDN article.
- Mike
Yesterday I paved my development PC (I was running a 32-bit beta of Windows 7) and moved to 64-bit Windows 7 Release Candidate. Paving the PC meant that I needed to re-install all of my favorite applications and tools.
Installing Windows Embedded CE 6.0 has a number of steps which are listed below (with appropriate links). Perhaps the list may be useful as a “check list” for installation if you are ever in the position of needing to install from ground up.
Installing Windows Embedded CE 6.0 – Steps:
- Mike
The CEFileWiz utility now has a new home on MSDN Code Gallery – The project page can be found here.
- Mike
I’m working on a side project, trying to get some code up and running that uses an old software stack and was having some issues – I decided to write a quick e-mail to the developer that initially worked on the stack to see if he had some ideas on how to get the code working. The e-mail exchange went something like…
Me: I’m working on a side project, having some issues with an old stack you worked on – here’s the details… blah, blah, blah. Any ideas ?
Reply: Computers are hard, Bunnies are soft.
Hmm… I’m not sure that helps… But, that does raise an interesting question… Why do some programming tasks that initially seem quick/easy take so much code and time to get working. It’s like that 30 minute DIY job at home, you have all of the right tools, and even instructions that appear to make sense, but it always take at least five times longer than expected.
- Mike
Let’s get started with a disclaimer, I’m a developer, I write code, that’s what I do, that’s what I’m good at – that means that my user interface design skills are somewhat lacking – I do a reasonable job of building forms based user interface for tools (CEFileWiz being an example) but that’s about as far as UI design/development goes for me. I’m a whizz at building operating system images, building COM objects, device drivers, native code web services etc… most of this you would consider to be plumbing, something that the user typically doesn’t (and shouldn’t) see.
When MFC (Microsoft Foundation Classes) shipped with support for CDialog and CFormView I was super happy, generating (some form of) application user interface became simple, I could drag controls from a toolbox onto a blank form and then “code behind” the controls. A very similar developer experience exists for C#/VB WinForms development in the managed world today.
If I needed to have a “fancy” user interface then that typically required some form of control subclassing and handling the paint message for the control by hand, this means that all of the user interface is really code driven, or to put it another way, the UI is “developer driven”. Changing the way the user interface looked required changes to code. From a Win32 C/C++ developers perspective all user interface elements are completely code driven. If you need some controls in the client area of your applications window then you need to create these by hand (CreateWindow), you need to place these by pixel coordinate, and subclass as appropriate to give the look and feel that makes sense for your device. In some cases controls may need to be animated, a drop down menu that scrolls open for example. Coding an animated drop down list would require creating a timer or thread and animating the control on each “tick” – that can be a lot of work, and even more work if the UI needs to change at some point in the future.
If we look at the desktop UI development experience (Windows Presentation Foundation for example) an application is really built by two groups of people, “Designers” and “Developers”. The designer/developer gets to focus on the work that they are good at and each are cleanly separated from each other – The designer only needs to care about the user interface look and feel and doesn’t care about the code behind the user experience. Animation, timelines, shading, fonts, images are all taken care of by the designer using tools like Microsoft Expression Blend. The developer then only focuses on writing the code behind the user experience and doesn’t need to care about what the UI looks like or even how the UI is implemented – the code in this case could be loading data sets to be displayed in the UI, or talking to web services, calling operating system APIs. Note that the developer doesn’t directly get involved in “how” the data is actually displayed to the user, but is involved in how the data is dealt with in the application. The developer is really focused on the plumbing, not on the UI. The link between designer/developer is XAML (eXtensible Application Markup Language) and Expression Blend (for UI) and Visual Studio (for the developer).
You could imagine that having a similar designer/developer story for building compelling user experiences for Windows Embedded CE devices would be awesome. This week, Kevin Dallas, General Manager for the Windows Embedded Business is showing a keynote demo at Computex, this demo shows the types of user experiences that could be build by decoupling the designer and developer experiences.
Since you are probably not at Computex we’ve recorded a video of the demo, and a brief interview with one of the Program Managers and Developers in the Windows Embedded CE Shell team that focus on applications and user experience.
User Interface Technologies for Windows Embedded CE
- Mike
Saul Hansel, “Bits Editor” for the New York Times has just posted an article to the NY Yimes web site called Microsoft wants gadgets to run Windows
Here’s some quotes from the article which I think is based on the Microsoft keynote from Computex in Taiwan earlier this morning.
On Tuesday Microsoft introduced the latest version of its operating system for gadgets called Windows Embedded CE.
Microsoft says that there are already one billion devices made each year that are neither computers nor cellphones that have embedded processors. These include industrial robots, medical test equipment and digital signs, many of which already use versions of Windows CE. Now Microsoft is hoping to extend the operating system to the rapidly growing set of consumer gadgets including media players, navigation systems, digital picture frames and digital televisions.
The improvements to Windows Embedded announced Tuesday are meant to make it easier for device makers to design more attractive user interfaces. In particular, they allow designers to use existing Microsoft tools, such as its Expressions Web design software and Visual Studio programming environment, to make the menus, buttons and other features of a device.
That last paragraph sounds extremely interesting! - “improvements… meant to make it easier for device makers to design more attractive user interfaces”.
I will post more information about this later this morning (actually at 9:00am Redmonia time).
- Mike
We recently released a CE 6.0 Binary BSP for Virtual PC 2007 – This can be quite useful for building and testing CE 6.0 images on your desktop PC, in much the same way as building and testing CE 6.0 operating system images using the existing ARM Device Emulator that ships with the CE 6.0 product.
When using the Virtual PC BSP you have the ability to “package” a CE 6.0 operating system image in a .VHD file (Virtual Hard Drive file) and boot stand-alone without the need for Platform Builder, this can be quite useful for demos, to share a stand-alone operating system image with your colleagues who don’t need Platform Builder and are only interested in writing applications from Visual Studio.
But… What if you want to see debug information from a Virtual PC based CE 6.0 operating system image? – We’ve just released a new PowerToy to the MSDN Code Gallery called PipeTerm, this is a handy utility that displays debug out from your CE 6.0 based operating system image running in Virtual PC 2007. Here’s a link to the MSDN Code Gallery PipeTerm project.
Virtual PC has the ability to map a serial port from the guest operating system (COM1 or COM2) either to a physical COM port on your development PC or to a named pipe, if you have a handy utility like PipeTerm sat listening on the other end of the pipe then you can display any data being pumped out of the serial port from the guest operating system running in Virtual PC 2007.
Enough explanation, it’s probably easier to just show you the utility running – check out the video below.
Video: Windows Embedded CE 6.0 PipeTerm Demo - Mike
Recently I posted some information about hosting a Silverlight 2.0 application on a Windows CE 6.0 based host – This was really straight forward, I built a (very) simple Silverlight 2.0 application in Expression Blend, this generates a .XAP file, I ran the Silverlight application from Expression Blend which launches a test page for the application. I then used IE to view | source and captured the HTML source to act as the host page on my CE 6.0 device. Adding the HTTPD Web Server to my CE 6.0 image, and copying the HTML and XAP files to \Windows\www\wwwpub was all that was needed to host the Silverlight 2.0 application on CE 6.0 and then view the application in my desktop browser.
Hosting the XAP/HTML was easy, but what can I actually do with the hosted Silverlight application? – The application is running in the context of my desktop browser, so doesn’t really know anything about my CE 6.0 device that is simply a bit-bucket to store the HTML and XAP files.
Ideally we need to get the device name or IP address of the CE 6.0 host from within the Silverlight application – if we have the IP address or device name then we can start calling exposed SOAP or REST functions on the CE 6.0 device.
I decided to create a new, simple Silverlight 2.0 application – Here’s the application UI in Expression Blend – it’s a very simple application that has a textBox and a Button.

The Silverlight application has two interesting files – app.xaml.cs and page.xaml.cs – we will need to make modifications to both files to get the host name/address, and then do something useful with the address in the application.
Step 1 – In Visual Studio (I’m using VS 2010, but this would work just as well in VS 2008) open the Silverlight 2.0 project, and expand the app.xaml.cs file.
The default OnStartup method looks like this…
1: private void OnStartup(object sender, StartupEventArgs e)
2: {
3: // Load the main control here
4: this.RootVisual = new Page();
5: }
We need to change the OnStartup function in two ways.
- Get the host name/address
- Pass the host name/address to the new page
The contents of the modified OnStartup should look like this.
1: private void OnStartup(object sender, StartupEventArgs e)
2: {
3: // Load the main control here
4: string HostAdr = this.Host.Source.OriginalString.Substring(0, this.Host.Source.OriginalString.Length - this.Host.Source.LocalPath.Length);
5: this.RootVisual = new Page(HostAdr);
6: }
Note that when we “new up” the page we’re passing the host address – this now requires that we make a change to the page.xaml.cs file.
I’ve created a variable to store the host address (private string HostAddress), you can see the default constructor (public Page()) which does nothing, I’ve added a new constructor that takes the host name/address from app.xaml.cs – The code for the new constructor stores the host name/address and then sets the textBox contents to be the address (so we can see the host address).
1: private string HostAddress;
2:
3: public Page()
4: {
5: // Required to initialize variables
6: }
7:
8: public Page(string HostAddr)
9: {
10: HostAddress = HostAddr;
11: InitializeComponent();
12: textBox2.Text = HostAddress;
13: }
I used CEFileWiz to create a component for the CE 6.0 catalog that contained the sample HTML file (I called this pFrame.html), and the sample XAP file (SilverlightApplication4.xap), I mapped both files to the \windows\www\wwwpub folder.
My CE 6.0 operating system image contains the HTTP Web Server (SYSGEN_HTTPD) and the sample files.
I can now boot my CE 6.0 image, browse to the IP address of the device (I’m displaying the IP address on my device UI) and that will bring up the default Windows CE “HTTPD Web Server is running” message. Appending a \pFrame.html to the URL will display the Silverlight 2.0 application which includes the web server host IP address (see below).

Now that I have the device address I can start working on calling exposed SOAP or REST services. My Silverlight 2.0 remote UI for CE 6.0 is coming together…
Look out for a follow up post on calling exposed SOAP/REST services on the CE 6.0 device.
- Mike
Make magazine have started building a green building monitoring system based on Windows CE and one of the SPARK hardware kits.
You can follow along with the project on the SPARK blog.
- Mike
We recently posted the CE 6.0 Virtual PC Binary BSP to the MSDN Code Gallery – I wanted to build something interesting using the Virtual PC BSP, so decided to build the obvious digital picture frame application with a twist.
Virtual PC supports serial input either from a physical COMx port on your development PC or using a named pipe. I decided to write a simple named pipe server application that pushes events from a USB Phidgets motion sensor (connected to my desktop PC) to the Virtual PC CE 6.0 o/s image. This would allow me to wave my hand over the motion sensor and have the images in the Virtual PC environment change. Cool (but completely useless!).
Anyhow, here’s the video.
Motion sensor enabled picture frame
- Mike
I’ve temporarily disabled the blog e-mail contact form for my blog due to blog e-mail spam. I will re-enable at some point in the near future.
if you want to send me questions you can do so at “mikehall @ microsoft.com”
- Mike
I get a reasonable number of questions about supporting Virtual PC 2007 from Windows Embedded CE 6.0. We’ve just published a CE 6.0 Binary BSP for Virtual PC 2007 on the MSDN Code Gallery site. Note that this is not an officially supported BSP (don’t phone product support, the only support mechanism will be through the Code Gallery discussions page).
The Virtual PC BSP ships with a Virtual Hard Drive (.VHD) and Virtual Floppy Disk so you don't need to create any boot media before starting to use CE 6.0 and the Virtual PC BSP.
Here’s a link to the MSDN Code Gallery CE 6.0 Virtual PC BSP project.
Virtual PC 2007 can be downloaded from here.
Look out for a video showing the BSP “in action” coming shortly.
- Mike