Re: Sharing code between PocketPC and Windows XP
From: Norman Bullen (norm_at_BlackKittenAssociates.com.INVALID)
Date: 08/12/04
- Next message: Victor Pang: "eVB app with SQL Server CE memory problem"
- Previous message: Norman Bullen: "Re: Is MulDiv function available under wince"
- In reply to: Mateusz Łoskot: "Re: Sharing code between PocketPC and Windows XP"
- Next in thread: r_z_aret_at_pen_fact.com: "Re: Sharing code between PocketPC and Windows XP"
- Reply: r_z_aret_at_pen_fact.com: "Re: Sharing code between PocketPC and Windows XP"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 01:43:38 GMT
Mateusz Łoskot wrote:
> On 8/12/2004 1:31 AM, Richard Coutts wrote:
>
>> Ideally I'd like them both the share the some body of code and just
>> compile for one or the other -- is that possible?
>
>
> Use preprocesor definitios like
>
> #ifndef(_WIN32_WCE)
>
> // code for non-Windows CE system
> #else
>
> // code for other Windows platforms
> #endif
>
> Look at MSDN for what definitions you may use, I give
> above only one example, the _WIN32_WCE identifier.
> Obviously, you have to create project files for eVC++ and
> for "big" VS and add the same source files to those projects.
>
> Greets
>
>
I have a small application that now runs on desktop Windows, Windows CE
(PocketPC) and Palm OS devices. It has a lot of #if defined(...)
statements in it to configure the code for these various platforms. As
you might guess, the Palm OS is the most different and, in some places,
I have essentially two separate streams of code to do more-or-less the
same thing.
In another, older, project I support desktop Windows and Windows CE in
both Palm-Size PC and Pocket PC versions. Because I couldn't in this
case simply use #if defined(_WIN32_WCE) because of the two different CE
platforms, I developed the following paradigm:
For each platform I create a header file named platform.h. In it I
define PLATFORM as DESKTOP, POCKET_PC, etc. and also define other
attributes of the system; the screen size, for example, in the case of
the application that also runs on Palm OS. I put the different
platform.h files in different subdirectories of the main source code
directory (.\desktop\platform.h , .\PocketPC\platform.h ,
.\PalmOS\platfrom.h , etc.) and in the project settings for each of the
different projects I add the appropriate directory as an additional
directory for include files. Every source module, of course, contains
#include "platform.h"
The major differences, at least for the Windows platforms, have to do
with screen size (your Pocket PC version may need to have scroll bars
where the desktop version does not, or you may have to build your
dialogs differently) and the different support from the shell. (The
Pocket PC shell manages the menu bar for you rather than having it as
part of your application, etc.
You also have to use Unicode in virtually all API calls so you might as
well use it through out the application. This means replacing "char"
with "TCHAR", "LPSTR" with "LPTSTR", and putting _T( ) around all of
your character and string literals.
I believe I've seen a book entitled _Making Windows Mobile_ which, I
think, is about porting desktop Windows code to Windows CE.
Norm
-- -- To reply, change domain to an adult feline.
- Next message: Victor Pang: "eVB app with SQL Server CE memory problem"
- Previous message: Norman Bullen: "Re: Is MulDiv function available under wince"
- In reply to: Mateusz Łoskot: "Re: Sharing code between PocketPC and Windows XP"
- Next in thread: r_z_aret_at_pen_fact.com: "Re: Sharing code between PocketPC and Windows XP"
- Reply: r_z_aret_at_pen_fact.com: "Re: Sharing code between PocketPC and Windows XP"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|