Prev: eVC 4 Startup error
Next: IMailSyncCallBack
From: mobilemobile on 17 Mar 2006 12:11 Thanks Daniel, in particular your article (http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html) -- a "Why didn't I think of that?". Of course -- 1) Create separate projects for each target (in same dir) 2) Point each project to the same code base 3) Create other constants besides the generated PocketPC/Smartphone in each project 4) Conditional compilation to target platform-specific features 5) Avoid "Change Target Paltform" completely 6) Point each project's build dirs to separate sub-dirs Does this sum it up as the way to go? Steve "Daniel Moth" wrote: > If you need to have separate binaries for different targets, then you will > need separate projects. You can share the code and use conditional > compilation for the different code paths. That is what the PocketPC > predefined constant is about (and you can define your own). This process is > traditionally used for targeting desktop and device but can equally be > applied to different device versions as you require: > http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html > > Change Target Platform makes no backup of your project so if you are going > to use that make sure you make a manual backup. It is useful for > creating/forking a new project typically going from PPC to SP. > > Cheers > Daniel > -- > http://www.danielmoth.com/Blog/ > > "mobilemobile" <mobilemobile(a)discussions.microsoft.com> wrote in message > news:D5258B7D-0F14-46AD-8309-66137B224161(a)microsoft.com... > > > > > > "Chris Scott" wrote: > > > > Thanks for your reply Chris. > > > >> What language are you developing with? > > > > VB and NETcf v2 > > > >> > >> Here's what I do for C/C++: > >> 1. I think there's a preprocessor constant defined that will give you > >> this. > >> I don't use the predefined ones because I can't trust that Microsoft will > >> keep them constant so I just define my own. You can define preprocessor > >> constants by target platform in the project properties. > >> > >> 2. I build separate EXE's for the separate OS's as it helps to keep > >> things > >> simpler for me. They build into their own separate directories > >> automatically, and my automated build process picks them up and rolls > >> them > >> into a CAB that's specific to the target OS. I think the 2003 EXE's are > >> supposed to run on WM5 if you follow all the rules, but I don't know if > >> it > >> works the other way around or not. > > > > Yeah, that sounds like what I've done in eVC, but VB seems to force you to > > only target one platform at a time. When I "Change Target Platform" VS > > closes the project then reopens, so I get the feeling it will only let me > > target one platform at a time, but I'm definitely not sure. I can't find > > options for compile/link by device like eVC. > > > >> > >> "mobilemobile" <mobilemobile(a)discussions.microsoft.com> wrote in message > >> news:4D8D1333-BD8C-46C6-A077-8ABB284DFF37(a)microsoft.com... > >> > 1) Is there a constant that I can use to separate PPC2003 from WinMob5? > >> > > >> > 2) Is there any reason to compile/build with the platform set to > >> > WinMob5 > >> > (rather than PPC2003) when I create the shippable versions? I've read > >> > elsewhere here that PPC2003 exe's will run on WinMob5 (assuming I'm not > >> > using > >> > deprecated classes etc). Are the exe's different? If I should have 2 > >> > versions (for both PPC2003 and WinMob5) is there any way to tell the > >> > project > >> > that each should go in different subdirectories? > >> > >> > >> > > >
From: Daniel Moth on 18 Mar 2006 09:43 > Does this sum it up as the way to go? Yes, I think so Cheers Daniel -- http://www.danielmoth.com/Blog/ "mobilemobile" <mobilemobile(a)discussions.microsoft.com> wrote in message news:DC652414-43BB-44AF-9CED-EF5A17817D58(a)microsoft.com... > Thanks Daniel, in particular your article > (http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html) -- > a > "Why didn't I think of that?". Of course -- > > 1) Create separate projects for each target (in same dir) > 2) Point each project to the same code base > 3) Create other constants besides the generated PocketPC/Smartphone in > each > project > 4) Conditional compilation to target platform-specific features > 5) Avoid "Change Target Paltform" completely > 6) Point each project's build dirs to separate sub-dirs > > Does this sum it up as the way to go? > > Steve > > "Daniel Moth" wrote: > >> If you need to have separate binaries for different targets, then you >> will >> need separate projects. You can share the code and use conditional >> compilation for the different code paths. That is what the PocketPC >> predefined constant is about (and you can define your own). This process >> is >> traditionally used for targeting desktop and device but can equally be >> applied to different device versions as you require: >> http://www.danielmoth.com/Blog/2004/09/share-code-if-fullframe_17.html >> >> Change Target Platform makes no backup of your project so if you are >> going >> to use that make sure you make a manual backup. It is useful for >> creating/forking a new project typically going from PPC to SP. >> >> Cheers >> Daniel >> -- >> http://www.danielmoth.com/Blog/ >> >> "mobilemobile" <mobilemobile(a)discussions.microsoft.com> wrote in message >> news:D5258B7D-0F14-46AD-8309-66137B224161(a)microsoft.com... >> > >> > >> > "Chris Scott" wrote: >> > >> > Thanks for your reply Chris. >> > >> >> What language are you developing with? >> > >> > VB and NETcf v2 >> > >> >> >> >> Here's what I do for C/C++: >> >> 1. I think there's a preprocessor constant defined that will give you >> >> this. >> >> I don't use the predefined ones because I can't trust that Microsoft >> >> will >> >> keep them constant so I just define my own. You can define >> >> preprocessor >> >> constants by target platform in the project properties. >> >> >> >> 2. I build separate EXE's for the separate OS's as it helps to keep >> >> things >> >> simpler for me. They build into their own separate directories >> >> automatically, and my automated build process picks them up and rolls >> >> them >> >> into a CAB that's specific to the target OS. I think the 2003 EXE's >> >> are >> >> supposed to run on WM5 if you follow all the rules, but I don't know >> >> if >> >> it >> >> works the other way around or not. >> > >> > Yeah, that sounds like what I've done in eVC, but VB seems to force you >> > to >> > only target one platform at a time. When I "Change Target Platform" VS >> > closes the project then reopens, so I get the feeling it will only let >> > me >> > target one platform at a time, but I'm definitely not sure. I can't >> > find >> > options for compile/link by device like eVC. >> > >> >> >> >> "mobilemobile" <mobilemobile(a)discussions.microsoft.com> wrote in >> >> message >> >> news:4D8D1333-BD8C-46C6-A077-8ABB284DFF37(a)microsoft.com... >> >> > 1) Is there a constant that I can use to separate PPC2003 from >> >> > WinMob5? >> >> > >> >> > 2) Is there any reason to compile/build with the platform set to >> >> > WinMob5 >> >> > (rather than PPC2003) when I create the shippable versions? I've >> >> > read >> >> > elsewhere here that PPC2003 exe's will run on WinMob5 (assuming I'm >> >> > not >> >> > using >> >> > deprecated classes etc). Are the exe's different? If I should have >> >> > 2 >> >> > versions (for both PPC2003 and WinMob5) is there any way to tell the >> >> > project >> >> > that each should go in different subdirectories? >> >> >> >> >> >> >> >> >>
From: mobilemobile on 18 Mar 2006 09:58 Thanks for your reply, Robert. As I mentioned in my reply to Chris' post, my issue is with VB2005, but I also have been using eVC4 -- it seems like your method (one workspace with one project per target platform) is the eVC equivalent of Daniel's suggestion. Steve "r_z_aret(a)pen_fact.com" wrote: > On Wed, 15 Mar 2006 09:26:30 -0800, mobilemobile > <mobilemobile(a)discussions.microsoft.com> wrote: > > >We're developing apps for Pocket PC 2003, but we also want to keep an eye on > >Windows Mobile 5.0 etc. For instance, to get a unique id, we're using > >KernelIoControl, but we also want to implement GetDeviceUniqueID (WinMob5 > >only). > > > >1) Is there a constant that I can use to separate PPC2003 from WinMob5? > >When I set the target platform to either "Pocket PC 2003" or "Windows Mobile > >5.0 Pocket PC SDK" both set PocketPC=TRUE (rather than "Windows Mobile 5.0 > >Smartphone SDK" which sets Smartphone=TRUE). Is there a constant > >specifically for WinMob5? > > I haven't tried VS 2005 yet, and so have not yet tried to develop > explicitly for WM 5. I _assume_ it will provide some way to > differentiate WM 5 and/or Pocket PC 2005 from earlier. > > I'm pretty sure I never make any actual run-time checks. But I do > include actual platform and OS in my About box. To get that info, I > use SystemParametersInfo with SPI_GETPLATFORMTYPE as the first > argument, plus GetVersionEx to get OS info. See > > // a 4 Jan 2003 contribution by Tim Wilson to a thread called "INF > // file for multiplatform setup" in this newsgroup. > // also, 7 July 2003 contribution from Yaroslav Goncharov to > // thread called > // "Running the same AP between Pocket PC and Pocket PC 2002" in > // microsoft.public.pocketpc.developer > // From 18 Jul 03 contribution from Almon B. Strowger to thread > // called > // eVC 4.0 vs VS.NET for C++ in > microsoft.public.pocketpc.develoepr: > // PPC2000 & PPC2002 report an OS major version of 3 > // PPC2003 reports an OS major of 4 and a minor of 20 > // See 25 Jul 03 contribution by Andre Joubert to thread called > // "How can I programatically determine the OS version" in > // comp.os.ms-windows.programmer.win32 for info about XP vs 2003 > Server > > > I definitely do use compile-time switches. I use the following to > define exactly one FOR... macro, and then use that in #ifdef > statments. > > #ifdef UNDER_CE > // #if defined( FOR_HPC ) || defined( FOR_PsPC ) || defined( > FOR_PsPC2 ) || defined( FOR_HPCPro ) || defined( FOR_PocketPC ) || > defined( FOR_HPC2K ) || defined( FOR_SSDK ) || defined( FOR_SSDK420 ) > || defined( FOR_DAP ) || defined( FOR_Smartphone ) || defined( > FOR_Smartphone2002 ) > // 16 Mar 04 (4.0.0.59) > #if defined( FOR_PocketPC2002 ) || defined( FOR_PocketPC2003 ) > #ifndef FOR_PocketPC > #define FOR_PocketPC > #endif > #elif defined( FOR_Smartphone2002 ) || defined( FOR_Smartphone2003 > ) > #ifndef FOR_Smartphone > #define FOR_Smartphone > #endif > #endif > #if defined( FOR_HPC ) || defined( FOR_PsPC ) || defined( FOR_PsPC2 > ) || defined( FOR_HPCPro ) || defined( FOR_PocketPC ) || defined( > FOR_HPC2K ) || defined( FOR_SSDK ) || defined( FOR_SSDK420 ) || > defined( FOR_DAP ) || defined( FOR_Smartphone ) > // do nothing (let caller override) > #elif _WIN32_WCE == 200 > #define FOR_HPC > #define WIN32_PLATFORM_HPC > #elif _WIN32_WCE == 201 > #define FOR_PsPC > #define WIN32_PLATFORM_PSPC > #elif _WIN32_WCE == 211 > #if defined( _WIN32_WC_PSPC ) || defined( WIN32_PLATFORM_PSPC) > #define FOR_PsPC2 > #elif defined( WIN32_PLATFORM_HPCPRO ) > #define FOR_HPCPro > #else > // Quotation marks added for resource compiler 16 Apr 03 > (4.0.0.1) > #error "Can't determine platform for CE 2.11" > #endif > #elif _WIN32_WCE == 300 > // WIN32_PLATFORM_PSPC is defined by eVC IDE > #if defined( _WIN32_WCE_PSPC ) || defined( WIN32_PLATFORM_PSPC > ) > // Could check whether WIN32_PLATFORM_PSPC==310 to detect Pocket > PC 2002, > // but BZ's code doesn't distinguish > // Support for FOR_PocketPC2002 added 31 Jan 05 (7.7.0.17) > #if WIN32_PLATFORM_PSPC == 310 > #define FOR_PocketPC2002 > #endif > #define FOR_PocketPC > // 1 Feb 04 (4.0.0.48) eVC 3 IDE defines WIN32_PLATFORM_HPC2000 > // #elif defined( _WIN32_WCE_HPC ) || defined( WIN32_PLATFORM_HPC > ) || defined( WIN32_PLATFORM_HPC2000 ) > #elif defined( WIN32_PLATFORM_HPC2000 ) > #define FOR_HPC2K > #elif defined ( WIN32_PLATFORM_WFSP ) > // 24 Feb 04 (4.0.0.54) > #if WIN32_PLATFORM_WFSP != 100 > #error WCE 300, but WIN32_PLATFORM_WFSP != 100 > #endif > #define FOR_Smartphone2002 > #define FOR_Smartphone > #else > // Quotation marks added for resource compiler 16 Apr 03 > (4.0.0.1) > #error "Can't determine platform for CE 3.0" > #endif > #elif _WIN32_WCE == 400 || _WIN32_WCE == 410 > // #define FOR_NET > #define FOR_SSDK > #elif _WIN32_WCE == 420 > // added 22 Oct 03 > #if defined( WIN32_PLATFORM_PSPC ) > // This is actually Pocket PC 2003, but BZ's code doesn't > distinguish > // Support for FOR_PocketPC2003 added 31 Jan 05 (7.7.0.17) > #define FOR_PocketPC2003 > #define FOR_PocketPC > #elif defined ( WCE_PLATFORM_CEXXXX ) > #define FOR_DAP > #elif defined ( WIN32_PLATFORM_WFSP ) > // 13 Mar 04 (4.0.0.59) > #if WIN32_PLATFORM_WFSP != 200 > #error WCE 420, but WIN32_PLATFORM_WFSP != 200 > #endif > #define FOR_Smartphone2003 > #define FOR_Smartphone > #else > #define FOR_SSDK420 > #endif > #else > // Quotation marks added for resource compiler 16 Apr 03 (4.0.0.1) > #error "Can't determine CE version" > #endif > #elif defined( FOR_Desktop ) > // do nothing (let caller override) > #else > #define FOR_Desktop > #endif > > > > > >2) Is there any reason to compile/build with the platform set to WinMob5 > >(rather than PPC2003) when I create the shippable versions? I've read > >elsewhere here that PPC2003 exe's will run on WinMob5 (assuming I'm not using > >deprecated classes etc). Are the exe's different? If I should have 2 > >versions (for both PPC2003 and WinMob5) is there any way to tell the project > >that each should go in different subdirectories? > > I use the original Pocket PC SDK with eVC 3 to build apps that run on > Pocket PC, Pocket PC 2002, Pocket PC 2003SE, and WM 5 for Pocket PC. I > regularly build using all the SDKs I have, but have not tested many of > the results. In particular, I'm not sure whether I've tested under WM > 5 something built using the Pocket PC 2003 SDK with eVC 4. But I'm > quite sure it would work. Bear in mind that I've been maintaining > maximum compatibility since Windows CE 2.0 (second edition HPC and > original Palm-size PC). > > I sure put executables for each platform in separate folders. I have > one workspace for each program. Within each of those workspaces, I > have one project for each platform. > > > > > >Thanks for any help, > >Steve > > ----------------------------------------- > To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message). > > Robert E. Zaret, eMVP > PenFact, Inc. > 20 Park Plaza, Suite 478 > Boston, MA 02116 > www.penfact.com >
From: r_z_aret on 18 Mar 2006 18:21
On Sat, 18 Mar 2006 06:58:26 -0800, mobilemobile <mobilemobile(a)discussions.microsoft.com> wrote: >Thanks for your reply, Robert. > >As I mentioned in my reply to Chris' post, my issue is with VB2005, but I >also have been using eVC4 -- it seems like your method (one workspace with >one project per target platform) is the eVC equivalent of Daniel's suggestion. I think so too, but I haven't even tried VB 2005. > >Steve > >"r_z_aret(a)pen_fact.com" wrote: > >> On Wed, 15 Mar 2006 09:26:30 -0800, mobilemobile >> <mobilemobile(a)discussions.microsoft.com> wrote: >> >> >We're developing apps for Pocket PC 2003, but we also want to keep an eye on >> >Windows Mobile 5.0 etc. For instance, to get a unique id, we're using >> >KernelIoControl, but we also want to implement GetDeviceUniqueID (WinMob5 >> >only). >> > >> >1) Is there a constant that I can use to separate PPC2003 from WinMob5? >> >When I set the target platform to either "Pocket PC 2003" or "Windows Mobile >> >5.0 Pocket PC SDK" both set PocketPC=TRUE (rather than "Windows Mobile 5.0 >> >Smartphone SDK" which sets Smartphone=TRUE). Is there a constant >> >specifically for WinMob5? >> >> I haven't tried VS 2005 yet, and so have not yet tried to develop >> explicitly for WM 5. I _assume_ it will provide some way to >> differentiate WM 5 and/or Pocket PC 2005 from earlier. >> >> I'm pretty sure I never make any actual run-time checks. But I do >> include actual platform and OS in my About box. To get that info, I >> use SystemParametersInfo with SPI_GETPLATFORMTYPE as the first >> argument, plus GetVersionEx to get OS info. See >> >> // a 4 Jan 2003 contribution by Tim Wilson to a thread called "INF >> // file for multiplatform setup" in this newsgroup. >> // also, 7 July 2003 contribution from Yaroslav Goncharov to >> // thread called >> // "Running the same AP between Pocket PC and Pocket PC 2002" in >> // microsoft.public.pocketpc.developer >> // From 18 Jul 03 contribution from Almon B. Strowger to thread >> // called >> // eVC 4.0 vs VS.NET for C++ in >> microsoft.public.pocketpc.develoepr: >> // PPC2000 & PPC2002 report an OS major version of 3 >> // PPC2003 reports an OS major of 4 and a minor of 20 >> // See 25 Jul 03 contribution by Andre Joubert to thread called >> // "How can I programatically determine the OS version" in >> // comp.os.ms-windows.programmer.win32 for info about XP vs 2003 >> Server >> >> >> I definitely do use compile-time switches. I use the following to >> define exactly one FOR... macro, and then use that in #ifdef >> statments. >> >> #ifdef UNDER_CE >> // #if defined( FOR_HPC ) || defined( FOR_PsPC ) || defined( >> FOR_PsPC2 ) || defined( FOR_HPCPro ) || defined( FOR_PocketPC ) || >> defined( FOR_HPC2K ) || defined( FOR_SSDK ) || defined( FOR_SSDK420 ) >> || defined( FOR_DAP ) || defined( FOR_Smartphone ) || defined( >> FOR_Smartphone2002 ) >> // 16 Mar 04 (4.0.0.59) >> #if defined( FOR_PocketPC2002 ) || defined( FOR_PocketPC2003 ) >> #ifndef FOR_PocketPC >> #define FOR_PocketPC >> #endif >> #elif defined( FOR_Smartphone2002 ) || defined( FOR_Smartphone2003 >> ) >> #ifndef FOR_Smartphone >> #define FOR_Smartphone >> #endif >> #endif >> #if defined( FOR_HPC ) || defined( FOR_PsPC ) || defined( FOR_PsPC2 >> ) || defined( FOR_HPCPro ) || defined( FOR_PocketPC ) || defined( >> FOR_HPC2K ) || defined( FOR_SSDK ) || defined( FOR_SSDK420 ) || >> defined( FOR_DAP ) || defined( FOR_Smartphone ) >> // do nothing (let caller override) >> #elif _WIN32_WCE == 200 >> #define FOR_HPC >> #define WIN32_PLATFORM_HPC >> #elif _WIN32_WCE == 201 >> #define FOR_PsPC >> #define WIN32_PLATFORM_PSPC >> #elif _WIN32_WCE == 211 >> #if defined( _WIN32_WC_PSPC ) || defined( WIN32_PLATFORM_PSPC) >> #define FOR_PsPC2 >> #elif defined( WIN32_PLATFORM_HPCPRO ) >> #define FOR_HPCPro >> #else >> // Quotation marks added for resource compiler 16 Apr 03 >> (4.0.0.1) >> #error "Can't determine platform for CE 2.11" >> #endif >> #elif _WIN32_WCE == 300 >> // WIN32_PLATFORM_PSPC is defined by eVC IDE >> #if defined( _WIN32_WCE_PSPC ) || defined( WIN32_PLATFORM_PSPC >> ) >> // Could check whether WIN32_PLATFORM_PSPC==310 to detect Pocket >> PC 2002, >> // but BZ's code doesn't distinguish >> // Support for FOR_PocketPC2002 added 31 Jan 05 (7.7.0.17) >> #if WIN32_PLATFORM_PSPC == 310 >> #define FOR_PocketPC2002 >> #endif >> #define FOR_PocketPC >> // 1 Feb 04 (4.0.0.48) eVC 3 IDE defines WIN32_PLATFORM_HPC2000 >> // #elif defined( _WIN32_WCE_HPC ) || defined( WIN32_PLATFORM_HPC >> ) || defined( WIN32_PLATFORM_HPC2000 ) >> #elif defined( WIN32_PLATFORM_HPC2000 ) >> #define FOR_HPC2K >> #elif defined ( WIN32_PLATFORM_WFSP ) >> // 24 Feb 04 (4.0.0.54) >> #if WIN32_PLATFORM_WFSP != 100 >> #error WCE 300, but WIN32_PLATFORM_WFSP != 100 >> #endif >> #define FOR_Smartphone2002 >> #define FOR_Smartphone >> #else >> // Quotation marks added for resource compiler 16 Apr 03 >> (4.0.0.1) >> #error "Can't determine platform for CE 3.0" >> #endif >> #elif _WIN32_WCE == 400 || _WIN32_WCE == 410 >> // #define FOR_NET >> #define FOR_SSDK >> #elif _WIN32_WCE == 420 >> // added 22 Oct 03 >> #if defined( WIN32_PLATFORM_PSPC ) >> // This is actually Pocket PC 2003, but BZ's code doesn't >> distinguish >> // Support for FOR_PocketPC2003 added 31 Jan 05 (7.7.0.17) >> #define FOR_PocketPC2003 >> #define FOR_PocketPC >> #elif defined ( WCE_PLATFORM_CEXXXX ) >> #define FOR_DAP >> #elif defined ( WIN32_PLATFORM_WFSP ) >> // 13 Mar 04 (4.0.0.59) >> #if WIN32_PLATFORM_WFSP != 200 >> #error WCE 420, but WIN32_PLATFORM_WFSP != 200 >> #endif >> #define FOR_Smartphone2003 >> #define FOR_Smartphone >> #else >> #define FOR_SSDK420 >> #endif >> #else >> // Quotation marks added for resource compiler 16 Apr 03 (4.0.0.1) >> #error "Can't determine CE version" >> #endif >> #elif defined( FOR_Desktop ) >> // do nothing (let caller override) >> #else >> #define FOR_Desktop >> #endif >> >> >> > >> >2) Is there any reason to compile/build with the platform set to WinMob5 >> >(rather than PPC2003) when I create the shippable versions? I've read >> >elsewhere here that PPC2003 exe's will run on WinMob5 (assuming I'm not using >> >deprecated classes etc). Are the exe's different? If I should have 2 >> >versions (for both PPC2003 and WinMob5) is there any way to tell the project >> >that each should go in different subdirectories? >> >> I use the original Pocket PC SDK with eVC 3 to build apps that run on >> Pocket PC, Pocket PC 2002, Pocket PC 2003SE, and WM 5 for Pocket PC. I >> regularly build using all the SDKs I have, but have not tested many of >> the results. In particular, I'm not sure whether I've tested under WM >> 5 something built using the Pocket PC 2003 SDK with eVC 4. But I'm >> quite sure it would work. Bear in mind that I've been maintaining >> maximum compatibility since Windows CE 2.0 (second edition HPC and >> original Palm-size PC). >> >> I sure put executables for each platform in separate folders. I have >> one workspace for each program. Within each of those workspaces, I >> have one project for each platform. >> >> >> > >> >Thanks for any help, >> >Steve >> >> ----------------------------------------- >> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message). >> >> Robert E. Zaret, eMVP >> PenFact, Inc. >> 20 Park Plaza, Suite 478 >> Boston, MA 02116 >> www.penfact.com >> ----------------------------------------- To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message). Robert E. Zaret, eMVP PenFact, Inc. 20 Park Plaza, Suite 478 Boston, MA 02116 www.penfact.com |