OS version

  • Thread starter Thread starter Zanna
  • Start date Start date
Z

Zanna

Hi,

I searched into old post but I cannot find a good solution.

Can I determine if the OS is a pocketPC or a WinCE?

Can I also get the relative version? (ppc2002, ppc2003... wince 4...)

Thank you
 
Using System.Environment.OSVersion you can retrieve the version of the
Windows CE OS used:-
Pocket PC 2000 and 2002 use 3.0
Pocket PC 2003 uses 4.2

To determine the platform name (PocketPC, Smartphone etc) requires a
P/Invoke to the SystemParamtersInfo function e.g.
public static string PlatformName

{

get

{

//allocate buffer to receive value

byte[] buffer = new byte[32];

//call native function

if(!SystemParametersInfo(257, buffer.Length, buffer, 0))

{

throw new ExternalException("Retrieving platform name failed");

}

//get string from buffer contents

string platformname = System.Text.Encoding.Unicode.GetString(buffer, 0,
buffer.Length);

//trim any trailing null characters

return platformname.TrimEnd('\0');

}



[DllImport("coredll", EntryPoint="SystemParametersInfo")]

private static extern bool SystemParametersInfo(int action, int size, byte[]
buffer, int winini);


Peter
 
Try the following...


public enum OSVersions {Unknown, PPC2002, PPC2003}


public static OSVersions OSVersion()

{

string ver = System.Environment.OSVersion.Version.ToString();

if (ver == "3.0.11171")

return OSVersions.PPC2002;

else

if (ver == "4.20.1081")

return OSVersions.PPC2003;

else

return OSVersions.Unknown;

}

public static string OSVersionText()

{


switch (OSVersion())

{

default:

case OSVersions.Unknown :

return "";

case OSVersions.PPC2002:

return "PPC2002";

case OSVersions.PPC2003:

return "PPC2003";

}

}

/// <summary>

/// Returns a textual description for the level of CF service pack
installed.

/// </summary>

/// <returns>string</returns>

public static string CFSPVersion()

{

string cfVer = System.Environment.Version.ToString();

if (cfVer == "1.0.2268.0")

return "Base";

else

if (cfVer == "1.0.3111.0")

return "SP1";

else

if (cfVer == "1.0.3316.0")

return "SP2";

else

return "";

}
 
Peter said:
Using System.Environment.OSVersion you can retrieve the version of the
Windows CE OS used:-
Pocket PC 2000 and 2002 use 3.0
Pocket PC 2003 uses 4.2

But... winCe 4.1 is a PocketPC2003?

OSVersion also tell me that my PocketPC is a Windows CE 3.x...

mmmmh... I'm confused :)

See you
 
All PocketPC's run a particular version of the Windows CE operating system,
just like Peter said.

If you have a PocketPC 2003 it will run the Windows CE.NET 4.2 operating
system. All other PocketPC's (2002 & 2000) will run version 3.0 of Windows
CE, os if yours returns CE 3.x you either have a PocketPC 2000 or a PocketPC
2002. If you want some clarity on the differences between Windows CE and
PocketPC you can take a look here:
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=317.
 
Back
Top