Application Development related
The update for Compact 2013 is finally up on MSDN. This works in Visual Studio 2013. Windows Azure is to be renamed Microsoft Azure. WEShapWiz can directly generate a C# Compact 2013 project as an OS Subproject that builds with the OS!
Read the rest of entry »
Hey, I’m excited! I hope you are too. I’ve cracked the code for building C# apps directly with the OS build. That is, as an OS Subproject of a Windows Embedded Compact OS project the Managed Code project can be built and run as with Native Code apps. No SDK needed! No second instance of Visual Studio. There are actually a few ways for doing this but shouldn't we be able to do it like native code subprojects.
I will in time blog about the development gotchas.
The app is called FootyWhatif
Make .NET CF the same as desktop .NET
Windows Pads .. Windows 7, CPUs, Windows CE, Windows Embedded Standard 7
Lets completely work through a Platform Invoke Example.
For simplicity I’ll use a Windows Mobile Emulator, but it would simply apply to an actual Windows Mobile Device/Windows CE device.
Visual Studio 2008 with a suitable Windows Mobile or Windows CE Emulator/SDK installed.
Using C# for the application and C++ for the native DLL.
I have also tried this on my Windows Mobile 6.53 Phone
Create a new C# Smart Device Project .. Ignore the .NET Version in the first step. Call it PInvoke.
Choose a suitable Target Platform, Set the .NET CF Version (I selected 2.0), Select Device Application (This creates a Windows Form App)
A Windows CE Target might be a suitable choice.
Complete the project creation, the Target Form will show.
Add a Button and Text Box
Double Click on the button add the code:
textBox1.Text = DateTime.Now.ToString();
Build and run the ...
Native and Managed Code
Native code is code written in C++ (or assembler) and compiled to produce a binary executable or .DLL. Native code applications are CPU specific and only require the executable and any other required native .DLLs. Native code applications and .DLLs do not produce MSIL code.
Managed code applications are written in C# or VB.NET using the .NET Compact Framework (CF). Unlike desktop .NET, C++ cannot be used to code .NET CF (Smart Device) applications. CF provides a rich library of functionality and is not compiled in a processor specific manner.
.Net CF is in the main, a subset of the desktop .NET Framework with some added features that make sense on a Windows CE/Windows Mobile device. It builds to the same MSIL code as the desktop .NET. As a simple test, build a simple CF windows form application and build it. Choose a non x86 platform such as Windows Mobile/Pocket PC. Build the application. Go to its build directory, on the development machine and run the application dir ...
This is where native code meets .NET. Its very much a black art, lots of smoke and mirrors etc. etc… But a necessary evil with Windows CE. That is because it is the gateway from .NET applications to the hardware and to the operating system. This is the first of a series of blogs on this matter.
I must though give credit to others’ who shoulders I am standing on for this. Whilst I have had experience with PInvoke going back to the first version of .NET CF on Windows CE (I think it was about V4.2) I have referenced a number of sources in an attempt to provide a comprehensive coverage of this topic. I’ll provide a reading list and some links in a later blog.