CF Program running in Desktop Framework

  • Thread starter Thread starter Christian Stelte
  • Start date Start date
C

Christian Stelte

Hello!

My CE Program runs half-decent on my desktop, if I start the exe.

It is possible to determinate on which framework (ce or desktop) the program
runs?
In that case it might be possible to decide which function or dll.call the
program should use?
So that I can create a CE-Program that runs also on a desktop-pc without
recompile it.

Is this possible? If I understand the .net right, it is one of the
fundamental ideas creating plattform independent programs!?

Chris
 
generally the Compact Framework is a direct subset of the full framework and
because the Compact Framework runtimes are marked as retargettable,
applications built for .NETCF will run on the desktop. There are a few
exceptions you should be aware of though:-

There are a couple of assemblies which are unique to the Compact Framework -
System.Net.IrDA, System.Data.SqlServerCe and Microsoft.WindowsCE.Forms

File paths are different on Windows CE to desktop versions of windows

If your program involves using Platform Invoke to API functions these may be
located in a different dll on the desktop - e.g. in Windows CE most API
functions are in coredll.dll but on the desktop exist in a range of separate
dlls kernel32.dll etc

Peter
 
To determine what platform your code is running on, use
System.Environment.OSVersion.Platform
 
Chris,

On the desktop, your app will use the desktop CLR (framework.) As Peter
points out, there are differences that you would need to account for if
you're using platform-specific functionality. Depending on what it is, you
can either branch to the appropriate code depending on the platform (in the
case of p/Invoke's for example) or load an assembly at run-time that
contained the platfrom-specific code. This would be useful if your
application provided some additional functionality when running on the
desktop or if you were using functionality that is implemented significantly
different on the two platforms, such as MessageWindow. With just a little
effort, I've become convinced you can get very good interoperability between
CE and desktop.

Bill
 
Back
Top