sâmbătă, 31 august 2013

How to Check for Windows CE Platform Builder Updates

In order to verify whether you have the latest version of Windows CE Platform Builder installed you can use the CEUpdateCheck.exe tool which is typically found in:
C:\Program Files\Microsoft Platform Builder\6.00\cepb\SustainedEngineering
Running this tool and selecting the "Verify Updates" button will list the updates that you have installed and the ones that you have not yet installed, categorized by year. This will allow you to locate and install the latest update pack much easier on the Microsoft website.
The latest release is R3, and after that there is a cumulative update and for 2013 there are monthly updates that need to be installed one at a time.

miercuri, 14 august 2013

Passing structures to C++ using C#

An ever reoccurring problem for developers having to integrate legacy C++ libraries with .NET Framework projects is passing structures to the C++ layer and getting back the results.
I have searched the web and I have found a few threads looking into this problem as well as the official MSDN documentation.


For my own needs, I am using the following code snippet, that is used to pass a structure by reference to a C++ function and get back the structure filled with the data.

In the code below, the StructureToPass structure must match the definition of the equivalent C++ structure and must be decorated with the StructLayout(LayoutKind.Sequential) attribute.

public struct StructureToPass  
        public uint x;       
        public float y;
        public float z;

StructureToPass tsData = new StructureToPass();
IntPtr strPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tsData));


    Marshal.StructureToPtr(tsData, strPtr, false);

    if ( 0 == GetStructureFromCPP(strPtr))
tsData = (StructureToPass)Marshal.PtrToStructure(strPtr, typeof(StructureToPass));

catch (Exception ex)

Visual Studio 2005 C1001 compiler error

While compiling a C++/CLI project from within Visual Studio 2005 I received error C1001 - internal compiler error, file msc1.cpp line 1393. The reported error seemed to originate in a header file containing the class definition.
Cleaning and rebuilding the project helped me solve the issue.

More on internal compiler errors can be found here:
though it was not the case for my particular situation.