Friday, 9 July 2010

…and the winners are:

Congratulations to the winners of Microsoft’s competition for students: Imagine Cup 2010! Over 325,000 students from more than 100 countries participated in three categories in this years Imagine Cup with the theme: “Imagine a world where technology helps solve the toughest problems”:


Winners:
Software Design:
Team Skeek from Thailand with “eyeFeel”, a program that helps communicating with people with a hearing disorder

Embedded Development:
Team SmarterME from Taiwan with a smart electricity meter

Game Design:
Team By Implication from the Philippines with a game animating students to work in an honorary capacity

Each winning team was awarded $25,000, again congratulations!

You can participate in next years Imagine Cup here.

Have fun!
Read more! Post this to a friend!

Monday, 5 July 2010

Customizing oomui (Out of Memory User Interface Component)

Hello guys,

There are quite a lot helpful articles trying to guide you to the more or less painful steps of substitution of public CE components. First I had a look at the CE 6.0 online help and "Customizing a UI Component". MS advices you to modify public code ...

Everyone knows - that's really a bad!
Some time ago there was an article by Steve Maillet, referenced by many newsgroup posts. But it isn't there anymore (http://www.embeddedfusion.com/Articles/CustomCoreUI.htm). Do you have a local copy? Please spread it!

In the end I played around with the various environment variables listed in the help topic and - what a wonder - when sysgen finally buildt gwes.dll the linker took my own oomui.lib. So, technically the solution works - but only at first glance! I didn't want to run an extra sysgen step to get my version of gwes.dll. The solution has to work in a single sysgen run, too.
One of my colleagues told me that he runs nmake to build the usb stack. So, I spent some time playing around with nmake, environment variables and trying to understand the involved makefiles, batches and so on. Finally I arrived at the conclusion that this way does not work. Unfortunately, some libraries are deleted by building the gwes target so I always ended up with linker errors (at least _GwesMain).

May be I missed something. If you have got a clue let me know! But as far as I noticed there is no other way to hook into the sysgen step (after platform binaries have been built) to get gwes.dll linked with the platforms oomui.lib.

My solution is quite simple and definitively works without any changes to public code. The only disadvantage is that you have to copy the files after you changed something in your oomui code.

1. Clone oomui code from \PUBLIC\COMMON\OAK\DRIVERS\OOMUI
2. Adapt it according to your requirements, e.g.



void OomUI_OnShow (void)
{
RETAILMSG(1, (TEXT("%S"), "This Text is just for checking correct linking"));
}
BOOL OomUI_FShowOomWindow (void)
{
return 0;
}
LRESULT CALLBACK OomUI_OomWndProc (HWND hwnd, UINT message, WPARAM uParam, LPARAM Param)
{
return DefWindowProc(hwnd, message, uParam, lParam);
}

LRESULT CALLBACK
OomUI_NotRespondingWndProc (HWND hwnd, UINT message, WPARAM uParam, LPARAM lParam)
{
return DefWindowProc (hwnd, message, uParam, lParam);
}
void OomUI_SetWindowsInfo (int cApps, WINDOWINFO *rgwi)
{
}



3. Compile (modify sources and makefile.inc before)

makefile.inc:

resfile: $(_RELEASELIBDIR)\$(RESFILE)

$(_RELEASELIBDIR)\$(RESFILE) : $(_OBJDIR)\$(RESFILE)
copy $? $@


sources

resfile: $(_RELEASELIBDIR)\$(RESFILE)
$(_RELEASELIBDIR)\$(RESFILE) : $(_OBJDIR)\$(RESFILE)
# lib will be stored in C:\WINCE600\OSDesigns\\\Wince600\_\oak\lib\\\oomui.lib
RELEASETYPE=OAK

TARGETNAME=oomui
TARGETTYPE=LIBRARY

CDEFINES= $(CDEFINES) -DGWE

!IFDEF MEM_ACCOUNT
CDEFINES=$(CDEFINES) -DMEM_ACCOUNT=1
!ENDIF

SOURCES=oomui.cpp
RESFILE=oomui.res
WINCETARGETFILES=resfile
FILE_VIEW_INCLUDES_FOLDER=oomuirc.h
FILE_VIEW_ROOT_FOLDER=oomui.rc


4. Add oomui to the appropriate dirs file
5. Copy oomui.* files to \prebuild\oomui\ directory (you have to add this directory to change control system)
6. Extend your .bat:


set REPLACE_SYSGEN_OOMUI=1
set GWES_REPLACE_COMPONENTS=oomui
set REPLACE_ROOT=%_PROJECTOAKROOT%\..


Done!

As already mentioned: I really appreciate improvements, hints, comments!

Cheers,
Jürgen


Read more! Post this to a friend!

Thursday, 1 July 2010

Windows Embedded Compact 7 – Installation

Hi folks,

as you all know, the Windows Embedded Compact 7 Public CTP is available since the beginning of June.

Today I want to talk about the Installation experience:

Prerequisites:

NOTE:
If you install Expression Blend 3 after Windows Embedded Compact 7, you will have to manually reinstall the Windows Embedded Silverlight Tools (WEST) in order to get the Silverlight for Windows Embedded Application template.

Windows Embedded Compact 7 Public CTP:
  • You need a Windows Live ID
  • Go to the Connection Directory and find Windows Embedded Compact and apply for the free program

  • Choose “downloads” on the Windows Embedded Compact 7 Public CTP program page

NOTE:
The link to the Connection Directory on the official Windows Embedded Compact 7 homepage is incorrect as of now.


To install Windows Embedded Compact 7 completely you need to have approximately 55 GB of free hard disk space available on C:\ even if you want to install it onto a different drive. Apparently, the current Windows Embedded Compact 7 installer checks for free space on the C:\ drive regardless of the targeted drive.


Since this is a beta version I would recommend to install Windows Embedded Compact 7 in a virtual mashine.

Have fun!
Read more! Post this to a friend!

Tuesday, 29 June 2010

Windows CE Live Chat Transcript June 2010

Hello guys,

Just in case you missed the MS Live chat today, the transcript of the chat is available here.

GLanger[MS] (Expert)[2010-6-29 18:6]: Hi, I'm Glen Langer, PM on the Core Team for Windows Embedded Compact

rajran[MS] (Expert)[2010-6-29 18:8]: Hi, I'm Rajeev Rangappa. PM on the Core team for Windows Embedded Compact

davbo-MSFT (Moderator)[2010-6-29 18:12]:

Q: Hi!. Does exist too many differences in DirectShow between CE 4.2 and 5 or 6? Because I have been trying to play mpeg1 video with WMP (CE 6.0 R3 and CE 5.0) in an ARM platform and in a X86 platform, but it plays very slow (~5 fps). But when I tried with my x86 platform with wince 4.2, it plays fine! Also, with alternative software (TCPMP) I can play fine too (in 5.0 and 6.0), but i need to do it with WMP. Thank you!

A: Hello Leonardo, Windows Embedded Compact 7 is available as a Public CTP (Community Tech Preview) which includes optimizations for MPEG-1 streaming. If there is a BSP available for your platform please try the Public CTP. Windows Embedded Compact 7 Public CTP

davbo-MSFT (Moderator)[2010-6-29 18:12]:

A: http://www.microsoft.com/windowsembedded/en-us/products/windowsce/compact7.mspx

Travis Hobrla [MS] (Expert)[2010-6-29 18:14]:

Q: Hi, we are trying to build, on Windows CE 6.0 (R2, last tests with R3), a DPWS device acting also as a host. We are trying to use WSDAPI.

Here the 2 problems we are facing:

1. Registering multiple service instances (at the moment not supported in the Windows CE WSDAPI stack, we have been said). A possible workaround is to host each of the service instances on multiple device hosts, but there is a limitation of 5 device hosts, indicated in Windows CE 6.0 R2 release notes (it does not seem to be improved in R3).

We don't know if the feature is supported (or the workaround improved) in Windows CE 7 (Public CTP), can you help us?

2. We have a problem in receiving UDP multicast on ARMv4i board. WSDAPI-based communication fails as multicast requests (Resolve/probe messages) are sent but not received on the board (verified with Netmon and netlogctl), even if we avoid using activeSynch. Besides the emulator limitation, are there Windows Ce issues concerning multicast with real HW?

A: For #2, I don't believe there are limitations. Are the multicasts failing to trigger the ethernet driver's receive function?

kurtken_msft (Expert)[2010-6-29 18:15]:

Q: What is the tool chain for developing for Windows Embedded Commpact 7? (ie. what versions of visual studio and such)

A: Windows Embedded Compact 7 installs as a plug-in to Visual Studio 2008.

Travis Hobrla [MS] (Expert)[2010-6-29 18:19]:

Q: In response to Travis Hobrla, yes, it seems so. So it could be a driver problem, you suggest?

A: Yes, if you're not picking up multicast at the driver level then you need to debug why that is the case. Perhaps you have configured the driver to execute a hardware filter that rejects multicasts?

davbo-MSFT (Moderator)[2010-6-29 18:25]:

Q: @davbo-MSFT: I'll try, but this application is for a released product, we can't update O.S.. So, I would like to modify "something" in order to improve fps. I thought that my board (Mini2440, ARM) was not so powerful to play videos, but other software can do it (TCPMP), but it may not use DShow, just DDraw (i'm not 100% sure about it). But in older boards with CE 4.2 it works well! I tried editing CEPlayIt example, but nothing... any other idea?? Thank you!

A: Can you provide details about the video file? What is the size, audio format, video format, resolution, etc..? Are you playing locally? If so using SATA, USB, SD, Flash, etc... or are you playing over HTTP?

davbo-MSFT (Moderator)[2010-6-29 18:25]:

Q: Hi!. Does exist too many differences in DirectShow between CE 4.2 and 5 or 6? Because I have been trying to play mpeg1 video with WMP (CE 6.0 R3 and CE 5.0) in an ARM platform and in a X86 platform, but it plays very slow (~5 fps). But when I tried with my x86 platform with wince 4.2, it plays fine! Also, with alternative software (TCPMP) I can play fine too (in 5.0 and 6.0), but i need to do it with WMP. Thank you!

A: Answered and following up for more details

davbo-MSFT (Moderator)[2010-6-29 18:29]:

Q: What is the tool chain for developing for Windows Embedded Commpact 7? (ie. what versions of visual studio and such)

A: Visual Studio 2008 SP1 then Platform Builder w/ Windows Embedded Compact 7 Installation. Windows Embedded Compact 7 Public CTP now available:

<http://www.microsoft.com/windowsembedded/en-us/products/windowsce/compact7.mspx>>

Travis Hobrla [MS] (Expert)[2010-6-29 18:30]:

Q: [to Travis] No, we haven't. But we know that there is a problem also in the board (BSP Evaluation Kit for AT91SAM9263E, "Multicast not implemented" in the technical design document). We just wanted to know if Windows CE had some limitations on its own on the hw side, and you said that it hasn't. About the Device Emulator, do you know if R3 or Windows Embedded Compact 7 solve the issue of not receiving multicast messages?

A: CE doesn't have limitations on the HW side, the BSP (not the OS) is firmly in control of what happens at the HW level for ethernet controllers. I don't believe there have been any substantial updates to the Device Emulator in R3, sorry. I assume the multicast limitation has to do with the way the NIC is emulated / connected to the desktop NIC.

Sing Wee [MS] (Expert)[2010-6-29 18:31]:

Q: Hi, I'm having some trouble with the CETK Storage Device Block Driver Read/Write test #2003. It is failing for my FMD since I upgraded CE6 from R2 to R3 and applied the latest QFEs. I noticed the test has changed from using four 1KB buffers to some larger buffer sizes. Is this test incompatible with the FMD interface now?

A: Gary, would you mind sharing the error messages that are returned? (Snippet from test log will be fine). I'm trying to find someone who might have the answer to your question.

Sing Wee [MS] (Expert)[2010-6-29 18:32]:

Q: So no one has ideas on my XAML Silverlight problems?

A: I've sent off an email to some folks who might have some insight. Could you please private message me your email address in case they've got some answers for you?

davbo-MSFT (Moderator)[2010-6-29 18:33]:

Q: So no one has ideas on my XAML Silverlight problems?

A: We are talking with engineers in the background to help answer your question. Please stay tuned and if we can't address today will work to get a response and post in the transcript.

kurtken_msft (Expert)[2010-6-29 18:37]:

Q: Will you please briefly discuss the sound support options for windows CE? We would like to play various types of sound files from our C# applications.

A: Hi Ben. Besides normal uncompressed PCM files, if you are playing without using DirectShow you can use any codec that can plug into the Audio Compression Manager (ACM). There are simple codecs available on the internet and you can build your own if you like. If you want more advanced media rendering capability I suggest you look at the DirectShow APIs.

Travis Hobrla [MS] (Expert)[2010-6-29 18:38]:

Q: Hi, we are trying to build, on Windows CE 6.0 (R2, last tests with R3), a DPWS device acting also as a host. We are trying to use WSDAPI.

Here the 2 problems we are facing:

1. Registering multiple service instances (at the moment not supported in the Windows CE WSDAPI stack, we have been said). A possible workaround is to host each of the service instances on multiple device hosts, but there is a limitation of 5 device hosts, indicated in Windows CE 6.0 R2 release notes (it does not seem to be improved in R3).

We don't know if the feature is supported (or the workaround improved) in Windows CE 7 (Public CTP), can you help us?

2. We have a problem in receiving UDP multicast on ARMv4i board. WSDAPI-based communication fails as multicast requests (Resolve/probe messages) are sent but not received on the board (verified with Netmon and netlogctl), even if we avoid using activeSynch. Besides the emulator limitation, are there Windows Ce issues concerning multicast with real HW?

A: Just got information on #1: we haven't changed anything for this in the CE7 PCTP - so you are still limited to 5 hosts/clients in WSDAPI.

kurtken_msft (Expert)[2010-6-29 18:39]:

Q: ...Scatter/Gather Buffer[2]..........(0x00044FA0) ...Scatter/Gather Buffer[2] Length...(4096) ...Scatter/Gather Buffer[3]..........(0x00045FA0) ...Scatter/Gather Buffer[3] Length...(8192) Submitting read request.

Verifying...

Incorrect data at 0x000447A0. Expected: 0x00000200, Received: 0x00000100. Incorrect data at 0x000447A4. Expected: 0x000001FF, Received: 0x000000FF. Incorrect data at 0x000447A8. Expected: 0x000001FE, Received: 0x000000FE.

A: cool!

Sing Wee [MS] (Expert)[2010-6-29 18:42]:

Q: ...Scatter/Gather Buffer[2]..........(0x00044FA0) ...Scatter/Gather Buffer[2] Length...(4096) ...Scatter/Gather Buffer[3]..........(0x00045FA0) ...Scatter/Gather Buffer[3] Length...(8192) Submitting read request.

Verifying...

Incorrect data at 0x000447A0. Expected: 0x00000200, Received: 0x00000100. Incorrect data at 0x000447A4. Expected: 0x000001FF, Received: 0x000000FF. Incorrect data at 0x000447A8. Expected: 0x000001FE, Received: 0x000000FE.

A: Hey Gary, this appears to be very similar to an issue we've seen in CE6 as well, related to the FAL in CE6 that has been addressed in CE7. Is there any reason you won't be able to try out CE7? http://www.microsoft.com/windowsembedded/en-us/products/windowsce/compact7.mspx

davbo-MSFT (Moderator)[2010-6-29 18:42]:

Q: @BarnettD: Ok I will look into those links thanks. @davbo-MSFT (Moderator) I am new to these chats, where do I get a copy of the transcript later on, and thanks ?

A: Previous Transcripts: <http://msdn.microsoft.com/en-us/chats/bb250671.aspx>;. This transcript will be posted a couple of days after the chat.

kurtken_msft (Expert)[2010-6-29 18:42]:

Q: With the latest BSP for our platform the touch screen driver does not load unless Explorer is used as the shell (normally our application serves as the shell); any Ideas on what I should look at to trouble shoot this issue?

A: hi Ben. You may have to run the touch calibration in order to get the touch driver to work. Also, is there an error message when the touch driver does not load? do you see it try to load?

davbo-MSFT (Moderator)[2010-6-29 18:43]:

Q: @davbo-MSFT: I forget audio!: I tried without audio, but it's the same. Original file has MPEG1 Layer 2 Audio Codec, with 192 kb/s

A: Thanks for the additional info and we'll look into performance. If you can provide the media file that would help speed up the investigation. alias: davbo domain: microsoft.com

davbo-MSFT (Moderator)[2010-6-29 18:44]:

Q: @davbo-MSFT: it is an MPEG-1 Video, 320x240, Bitrate: 993 kb/s, Size: 2 Mb, I have tried with file in a lot of locations: SD, USB flash drive, even into NK.bin. Board i'm using has as storage unit a NAND Flash memory

A: Thanks for the additional info and we'll look into performance. If you can provide the media file that would help speed up the investigation. alias: davbo domain: microsoft.com

Travis Hobrla [MS] (Expert)[2010-6-29 18:45]:

Q: [to Travis] Ohh, ok, thank you. I suppose I can't ask you if there is a plan for future releases to enhance the limitation or support multiple service instances registration ...

A: We don't have plans to fix this that I know of, but I will see if I can make this happen. Can you give me some ammunition (i.e. why is this necessary for your product to succeed) that I can use to make a case for this?

Sing Wee [MS] (Expert)[2010-6-29 18:50]:

Q: I am currently developing a set of drivers on WINCE 6.0. I have R3 and all the montlhy updates up until February 2010. I am trying to add support for silver light and XAML. ( I am new to this). I have followed the msdn example on how to create the bubbles.xaml, bounce.xaml, and carousel.xaml demos. I have create the xamlperf.exe app and i can see the demos on the deskptop when the wince device boots up. BUt when I try to run the demos I can see a window that tries to open and then the window creation seems to stop (the window doesn't show up). In the debugger I can see the "performance info" that it outputs but I also get an "ALCHEMY error"

Any ideas what I am missing. All of my demos seem to get built but when I run them I don't see any output on the screen and on the debugger window i see "[ALCHEMY] Failed to Draw the element tree in HWND 0x70026530. Error code 0x8000ffff . ANy ideas what may be wrong?

A: KibKid, what type of drivers are you developing? Display drivers? Also, which SYSGENs are set in your build environment? (If you open a build window, just do a "set SYS".

Sing Wee [MS] (Expert)[2010-6-29 18:51]:

Q: Well, I need to download and test with CE7 also, but I'm providing FMD and PDD for Spansion flash products to customers using various versions of CE. If there is a problem with FAL in CE6, then I would like to understand how to point my customers to the fix and if I should tell them to just avoid CE6 FAL and use a different version of CE...

A: Gary, can you please send me your private email address? I'm trying to get you answers.

davbo-MSFT (Moderator)[2010-6-29 18:52]:

Q: [to Travis] Ok, thanks. Same for Windows Embedded Compact 7, I suppose. I don't know if you could you also help me with my question 1 about WSDAPI (registering multiple service instances not supported).

A: Good link on WSDAPI if you haven't seen it yet. http://blogs.msdn.com/b/dandris/archive/2007/11/09/wsdapi-101-part-1-web-services-from-10-000-feet.aspx. I got some answers from the team managing the Windows CE side WSDAPI (which is different from the one on a Windows PC). Windows CE WSDAPI stack does not allow registering multiple services with the same name. Doing so will result in the error (CWSDSession:ispatcherIsUnique).

I can offer you two workarounds here.

1. Host each of the service instances on multiple device hosts, and have the clients contact different instances of the service by means of the device host’s address.

2. Duplicate the same service and give those duplicated services different names so that you can host them on the same device host, and have the client contact those different services instead. You have to do

davbo-MSFT (Moderator)[2010-6-29 18:53]:

Q: @davbo-MSFT: of course!... I'll send you my file by email just now, thank you!

A: thanks

Sing Wee [MS] (Expert)[2010-6-29 18:54]:

Q: I've already installed QFEs up through May 31st 2010. Will you release a FAL fix as QFE for CE6? I assume many of my customers would rather not move to a new version of CE. Probably a fix to the FAL would be a preferred solution.

A: Yes, I understand the concern.

Chien-her[MS] (Expert)[2010-6-29 18:54]:

Q: Any ideas what I am missing. All of my demos seem to get built but when I run them I don't see any output on the screen and on the debugger window i see "[ALCHEMY] Failed to Draw the element tree in HWND 0x70026530. Error code 0x8000ffff . ANy ideas what may be wrong?

A: 0x8000ffff is E_UNEXPECTED

Travis Hobrla [MS] (Expert)[2010-6-29 18:57]:

Q: [to Travis] Yes, I am working on a M2M platform. At the web service level, we are treating all the services exposed by sensors/devices in the same logical way, and we can in this way deal with a number of services that can change dynamically in the network. By the way, my company in Italy has signed a “Non Disclosure Agreement” with Microsoft (in case this is needed, I can provide details about it).

A: Thanks Cris. I will promote this and see if we can make a fix (no guarantees, of course).

davbo-MSFT (Moderator)[2010-6-29 18:57]:

Q: @davbo-MSFT: ok, mail sent with attached file, please remove me from your spam folder (if i'm in it )

A: got the email - thanks

Chien-her[MS] (Expert)[2010-6-29 18:57]:

A: You will need to check out your display driver and ddraw. In R3, Alchemy graphic simulation could be done by GDI or DDraw. So you will need to check out the display diver support 2D acceleration or not and DDraw is in image or not. Any way as Sing mentioned the image configuration, SYSGEN_*, BSP_*, and IMG* flags.

davbo-MSFT (Moderator)[2010-6-29 18:57]:

Q: [to davbo] Thanks for the link and the info, we already know them but I appreciate your help

A: np

davbo-MSFT (Moderator)[2010-6-29 19:0]: Hello everyone, we are just about out of time.

Thank you for joining us for our Windows Embedded CE 6.0 chat today!

<http://www.Microsoft.com/Embedded>;

A special thank you to the product group members for coming out.

The transcript of today’s chat will be posted online as soon as possible, to <http://msdn.microsoft.com/en-us/chats>;. We’ll see you again for another chat next month. Please check <http://msdn.microsoft.com/en-us/chats>; for the list of upcoming chats.

Have fun!


Read more! Post this to a friend!

Windows Embedded CE: USB memory stick fix part 2

Hi foks,

Following up on my previous post about USB memory stick fixes; here is another fix for direct access of USB memory sticks. Again, the files mentioned reside under _PUBLICROOT\COMMON\OAK\DRIVERS\USB\CLASS\STORAGE\DISK\SCSI2. Be sure to clone the respective files to your Platform before altering them!

4 issues with direct access USB memory sticks

In the function GetMediumInfo in disk.c there are some USB memory sticks that do not recover well from the call to either of the ScsiModeSense6/ScsiModeSense10 commands which are used to retrieve the device type as well as the state of the write protect bit. Neither of these commands are necessary according to the SCSI-2 specification, anyway.

Fix:

Since the working USB memory sticks seem to return 0x80 as the pDevice->MediumType we will also set the medium type to 0x80 for direct access USB memory sticks. In addition we need to disable the write protect bit.

Replace the if statement following the
// determine medium type
comment with:

// USB Memory Stick fix:
//

if (SCSI_DEVICE_UNKNOWN != pDevice->DeviceType &&
SCSI_MEDIUM_UNKNOWN == pDevice->MediumType )
{
if(SCSI_DEVICE_DIRECT_ACCESS == pDevice->DeviceType)
{
DEBUGMSG(ZONE_TRACE,
(TEXT("Device type: Direct Access => force medium type\n") ));
// set device type to 0x80
pDevice->MediumType = 0x80;
// disable write protect
pDevice->Flags.WriteProtect = 0;
}
else
{
dwErr = ScsiModeSense6(pDevice, Lun);

if (ERROR_SUCCESS != dwErr)
{
TRANSPORT_DATA tData;
UCHAR senseData[18];

tData.TransferLength = 0;
tData.RequestLength = sizeof(senseData);
tData.DataBlock = senseData;
memset(senseData,0,sizeof(senseData));

dwErr = ScsiRequestSense(pDevice, &tData, Lun);

dwErr = ScsiModeSense10(pDevice, Lun);

if (ERROR_SUCCESS != dwErr)
{
break;
}
}
}
}

Have fun!
Read more! Post this to a friend!

Windows Embedded Developer Update for Windows Embedded Standard 7 (WES7) now available

Hi folks,

Microsoft has just released a new tool called Windows Embedded Developer Update (WEDU) which allows you to keep your development environment for WES7 up to date.

Previously you would have to search multiple websites it see if there are new updates for your WES7 development environment, now with WEDU you can discover and install updates automatically.

Don’t worry, if you are working with Windows Embedded Compact (previously known as Windows Embedded CE), WEDU will be available for Windows Embedded Compact 7 later this year.

You can download WEDU for WES7 here for free!

Also check out this video about WEDU on Olivier’s Blog.

Have fun!
Read more! Post this to a friend!

Thursday, 24 June 2010

Windows Embedded Compact 7: Silverlight for Windows Embedded Tutorial

Hi folks,

As previously stated, Windows Embedded Compact 7 comes with quite a lot of improvements with regards to Silverlight for Windows Embedded (SWE): SWE is now based on Silverlight 3 and the new Windows Embedded Silverlight Tools (WEST) generate most of the glue code so you don’t have to write the glue code manually any more!

Now let’s focus on our first, simple SWE application for Windows Embedded Compact 7. Let’s begin with the installation: make sure you install Expression Blend 3 prior to Windows Embedded Compact 7 to ensure that the new SWE template will be added to Expression Blend 3. Otherwise you need to reinstall the WEST tools manually after installing Expression Blend 3.

Create an Expression Blend 3 SWE project:

1. Open Expression Blend 3.
2. In Expression Blend 3 click on New Project…



3. In the New Project Dialog select Silverlight for Windows Embedded Application, set the Name to SWEApp, set the Location to C:\Expression\Blend3\Projects\ careful here as this path needs to be WITHOUT spaces.


NOTE:
Later on we will import the project into Platform Builder. Platform Builder cannot handle spaces in the path.
The only option in the Language field is Visual C#. The WEST will convert the C# code to C++ code upon importing the project into Platform Builder.
4. Click OK to create the new project.
5. On the left, double click the Button control to add a default sized button. On the right of the MainPage.xaml window, click on the Split button to display the XAML code underneath


6. In the Properties on the top right set the Name of the button to myButton, to be able to address the button in the SWE C++ code later on.


7. Click on the Events icon to the far right of the Name field and add an Event Handler called myClickMe in the Click field. Upon conversion to SWE C++ code this will generate a Click Event Handler which we will populate later.


8. Examine the XAML view to see that we have created a button named myButton with a Click Event Handler called myClickMe.


9. From the Expression Blend 3 menu select File ¦ Save All, afterwards minimize Expression Blend 3.

Create a SWE subproject in Platform Builder

10. Open your previously created Windows Embedded Compact 7 OSDesign supporting SWE (SYSGEN_XAML_RUNTIME set) in Visual Studio 2008 with Platform Builder.
11. With the OSDesign open, click Tools ¦ Windows Embedded Silverlight Tools ¦ Create Platform Builder Subproject.


12. In the wizard that appears, click Next then enter SWEApp in the Name field and D:\SWESubprojects in the Location field as the name and location for our subproject. Click Next.


13. Specify C:\Expression\Blend3\Projects\SWEApp\SWEApp\SWEApp.csproj as the Silverlight project to convert. The wizard automatically recognizes MainPage.xaml. Click Next.


14. Now the WEST tool does its magic! Notice that there were no errors converting our project. Click Finish to end the wizard.


15. Examine the Summary Report which will be opened in Visual Studio 2008.
16. In the Platform Builder Solution Explorer, right-click Subprojects ¦ Add Existing Subproject….


17. Browse to D:\SWESubprojects\SWEApp, select SWEApp.pbpxml. Then click Open.


18. Take a moment to examine the generated code in App.cpp, MainPage.cpp and WinMain.cpp. In Windows Embedded CE 6.0 R3 we would have to write ALL this glue code ourselves!


19. In MainPage.cpp locate the event handler that we have created in Expression Blend 3: MainPage::myClickMe. Add the following code to display a native message box towards the end of the event handler:
// display a native message box
MessageBox(NULL,TEXT("Hello from Silverlight for Windows Embedded!"),
TEXT("SWE Sample"),MB_OK ¦ MB_SETFOREGROUND ¦ MB_TOPMOST);

hr = S_OK;
Save the file.


20. In the Solution Explorer, right-click your OSDesign and select Properties.


21. In the appearing Property Pages dialog box, expand the Configuration Properties on the left, select Subproject Image Settings, double click SWEApp on the right and make sure that Exclude from image and Always build and link as debug are checked. Click Ok on both dialog boxes to accept the changes.


22. Right-click the SWEApp subproject and select build. Notice that our SWEApp built successfully with 0 errors and 0 warnings.


23. Congratulations! We can now start our image and run our SWEApp.



Don't miss fellow MVP Valter Minute's series of SWE tutorials for Windows Embedded CE 6.0 R3 on his Blog.

Have fun!
Read more! Post this to a friend!