It is possible to write code which runs 1:1 on Win CE 5.0 and Win CE 6.0.
If you are not doing any direct HW access, there is good chance that your code runs without any changes also on Win CE 6.0.
In case that your code accessing HW registers directly then you need to link your code with additional Toradex libraries. If you are using these library functions, you can run the same code in both, Win CE 5.0 and Win CE 6.0, and also even if you are doing direct HW access in your application.
You can download the required libraries from our Toradex CE Libraries.
Take a look at an example in Sample codes.
All Toradex Source Code Libraries work with Win CE 5.0 and Win CE 6.0.