_WIN32_WCE is hex and not decimal in VS2005  
Author Message
cmumford





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

I just noticed something and I can't figure out how it's working at all for anybody. Surely I'm missing something obvious. If I make a new project in eVC 4.0 then the project settings will define the following:

_WIN32_WCE=$(CEVersion)

So for my Pocket PC 2003 configuration _WIN32_WCE winds up having a value of 420 (decimal). This makes sense since all of the Windows CE Platform SDK's compare this constant with decimal values like 300, 420, and 500.

However if I create a new Smart Device project in VS2005 then the project settings define the following:

_WIN32_WCE=$(CEVER)

But this time $(CEVER) is defined as 0x420 (hex). Now all of the comparisons are incorrect.

Am I missing something here Surely this isn't a bug in VS2005!



Smart Device Development1  
 
 
VTaneja





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

Yes, $(CEVER) is defined as 0x420.
This is not a bug.


 
 
cmumford





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

Yes, $(CEVER) is defined as 0x420.
This is not a bug.

But isn't assigning $(CEVER) to _WIN32_WCE the bug since not only did this previously contain a decimal value, but all of the SDK's compare it with a decimal literal instead of a hex literal


 
 
Alex Feinman





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

I'm confused. Can you give me an example of an SDK include file that tests _WIN32_WCE against a particular value All I can find is just tests for it being defined

 
 
cmumford





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

Sorry for the long lines, but here are a few of the files:

c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#if defined(_WIN32_WCE_AYGSHELL) && (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#elif (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H: #if defined(_WIN32_WCE_AYGSHELL) && (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H: #if (_WIN32_WCE > 200) 
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H: #else // _WIN32_WCE > 200
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H: #endif // _WIN32_WCE > 200
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLBASE.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCOM.H:#if (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCOM.H:#if (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCOM.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCOM.H:#if (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCTL.H: #if (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCTL.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLCTL.H:#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 300)
c:\Program Files\Windows CE Tools\wce420\SMARTPHONE 2003\Atl\include\ATLHOST.H:#else if (_WIN32_WCE >= 300)

I have the following SDK's installed:

  • 2002 Pocket PC
  • 2002 Smartphone
  • Windows Mobile 5.0 Pocket PC SDK
  • Windows Mobile 5.0 Smartphone SDK

If I search through all the header files in C:\Program Files\Windows CE Tools then I come up with 473 comparisons with _WIN32_WCE and decimal literals and none of them are hex. 284 of them are in the samples, but 189 of them are in SDK headers for ATL and MFC. wce300, wce420, and wce500 all use decimal values when comparing with this constant.


 
 
Mario Chenier - Microsoft





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

VS2005 isn't using the Windows CE Tools\wce420 directories, it has the PPC and SP 03 SDK's under the following directory: C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\

Also VS2005 is using it's own version of the MFC\ATL libraries under C:\Program Files\Microsoft Visual Studio 8\VC\ce\atlmfc, and these versions assume hexidecimal values are passed in.

So I believe that the fact that it changed from Decimal to Hexidecimal is fine as all the files that VS2005 are including should have the correct representation. Assuming you are using the built in SDK's and ATL\MFC's.

What problems are you seeing exactly



 
 
MattEvans





PostPosted: Smart Devices Native C++ Development, _WIN32_WCE is hex and not decimal in VS2005 Top

Ah, that explains a few things we have been seeing.
Our application is built across most of the dev environments, e.g. we need to support Pocket PC, Pocket PC 2003, and WM5 devices.
We have project files for each development environment and the source is shared between them all. We use _WIN32_WCE to detect which o/s version we are building for so we can use the right API's etc.
When we tried building our code for PPC2003 in VS2005 we got all sorts of problems, and couldnt work out why _WIN32_WCE was reporting that the platform was > 420 for PPC2003! This has just solved it I guess.
Thanks
Matt