PC Review


Reply
 
 
Mark Johnson
Guest
Posts: n/a
 
      20th Nov 2003
>> Also, what are the pre-processor symbols I should use for checking for
>> CF/PPC vs. the desktop??
>> (On my continuing quest to get the same apps and libs working on both...)



I have not found a standard way of doining this.
There is no pre-processor symbols like DEBUG for this.
I use to the following work around:

(I am using a German Version, so I am not sure of the English expressions -
would like to have them BTW for Documentation)
Set the following in Framework.Compact Projects :

\Project\Properties\
Configuration : all configurations
\Configuration Properties\Set pre-processor for Compiling : COMPACT

The following works correctly :

#if (DEBUG && !COMPACT)
#warning Net.Framework (Debug) is defined
#elif (!DEBUG && !COMPACT)
#warning Net.Framework (Release) is defined
#elif (DEBUG && COMPACT)
#warning Net.Framework.Compact (Debug) is defined
#else
#warning Net.Framework.Compact (Release) is defined
#endif

a Sample of code that will run on both Mashines :

#if COMPACT
pn_Panel.Capture = true;
IntPtr hWnd = Win32Window.GetCapture();
pn_Panel.Capture = false;
p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
#else
p_IntPtr = p_Graphics.GetHdc();
p_Graphics.ReleaseHdc(p_IntPtr);
#endif

When shown in VS, the "inactive code" will be grey to show that it will not
be compiled.

Hope this helps

Mark Johnson, Berlin Germany
(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Lloyd Dupont
Guest
Posts: n/a
 
      20th Nov 2003
simple compile for the PPC, it will work directly on .NET 1.1 on the
desktop.

"Mark Johnson" <(E-Mail Removed)> a écrit dans le message de
news:3fbc61a8$0$8773$(E-Mail Removed)...
> >> Also, what are the pre-processor symbols I should use for checking for
> >> CF/PPC vs. the desktop??
> >> (On my continuing quest to get the same apps and libs working on

both...)
>
>
> I have not found a standard way of doining this.
> There is no pre-processor symbols like DEBUG for this.
> I use to the following work around:
>
> (I am using a German Version, so I am not sure of the English

expressions -
> would like to have them BTW for Documentation)
> Set the following in Framework.Compact Projects :
>
> \Project\Properties\
> Configuration : all configurations
> \Configuration Properties\Set pre-processor for Compiling : COMPACT
>
> The following works correctly :
>
> #if (DEBUG && !COMPACT)
> #warning Net.Framework (Debug) is defined
> #elif (!DEBUG && !COMPACT)
> #warning Net.Framework (Release) is defined
> #elif (DEBUG && COMPACT)
> #warning Net.Framework.Compact (Debug) is defined
> #else
> #warning Net.Framework.Compact (Release) is defined
> #endif
>
> a Sample of code that will run on both Mashines :
>
> #if COMPACT
> pn_Panel.Capture = true;
> IntPtr hWnd = Win32Window.GetCapture();
> pn_Panel.Capture = false;
> p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
> #else
> p_IntPtr = p_Graphics.GetHdc();
> p_Graphics.ReleaseHdc(p_IntPtr);
> #endif
>
> When shown in VS, the "inactive code" will be grey to show that it will

not
> be compiled.
>
> Hope this helps
>
> Mark Johnson, Berlin Germany
> (E-Mail Removed)
>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      20th Nov 2003
Since binaries are retargetable, there's no way for the compiler to know
what you're going to run the assemby on. Use
System.Environment.OSVersion.Platform to decide at run time what to do.

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


"Mark Johnson" <(E-Mail Removed)> wrote in message
news:3fbc61a8$0$8773$(E-Mail Removed)...
> >> Also, what are the pre-processor symbols I should use for checking for
> >> CF/PPC vs. the desktop??
> >> (On my continuing quest to get the same apps and libs working on

both...)
>
>
> I have not found a standard way of doining this.
> There is no pre-processor symbols like DEBUG for this.
> I use to the following work around:
>
> (I am using a German Version, so I am not sure of the English

expressions -
> would like to have them BTW for Documentation)
> Set the following in Framework.Compact Projects :
>
> \Project\Properties\
> Configuration : all configurations
> \Configuration Properties\Set pre-processor for Compiling : COMPACT
>
> The following works correctly :
>
> #if (DEBUG && !COMPACT)
> #warning Net.Framework (Debug) is defined
> #elif (!DEBUG && !COMPACT)
> #warning Net.Framework (Release) is defined
> #elif (DEBUG && COMPACT)
> #warning Net.Framework.Compact (Debug) is defined
> #else
> #warning Net.Framework.Compact (Release) is defined
> #endif
>
> a Sample of code that will run on both Mashines :
>
> #if COMPACT
> pn_Panel.Capture = true;
> IntPtr hWnd = Win32Window.GetCapture();
> pn_Panel.Capture = false;
> p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
> #else
> p_IntPtr = p_Graphics.GetHdc();
> p_Graphics.ReleaseHdc(p_IntPtr);
> #endif
>
> When shown in VS, the "inactive code" will be grey to show that it will

not
> be compiled.
>
> Hope this helps
>
> Mark Johnson, Berlin Germany
> (E-Mail Removed)
>
>



 
Reply With Quote
 
Mark Johnson
Guest
Posts: n/a
 
      20th Nov 2003
But it is not allway possible to compile Framework Code that is not
supported on the Compact
- like p_IntPtr = p_Graphics.GetHdc();
thus here the #ifdefs are usefull.
Do you have a practical Sample where you would use
System.Environment.OSVersion.Platform ?

Mark Johnson, Berlin Germany
(E-Mail Removed)

"Chris Tacke, eMVP" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> Since binaries are retargetable, there's no way for the compiler to know
> what you're going to run the assemby on. Use
> System.Environment.OSVersion.Platform to decide at run time what to do.
>
> --
> Chris Tacke, eMVP
> Co-Founder and Advisory Board Member
> www.OpenNETCF.org
> ---
> Windows CE Product Manager
> Applied Data Systems
> www.applieddata.net
>
>
> "Mark Johnson" <(E-Mail Removed)> wrote in message
> news:3fbc61a8$0$8773$(E-Mail Removed)...
> > >> Also, what are the pre-processor symbols I should use for checking

for
> > >> CF/PPC vs. the desktop??
> > >> (On my continuing quest to get the same apps and libs working on

> both...)
> >
> >
> > I have not found a standard way of doining this.
> > There is no pre-processor symbols like DEBUG for this.
> > I use to the following work around:
> >
> > (I am using a German Version, so I am not sure of the English

> expressions -
> > would like to have them BTW for Documentation)
> > Set the following in Framework.Compact Projects :
> >
> > \Project\Properties\
> > Configuration : all configurations
> > \Configuration Properties\Set pre-processor for Compiling : COMPACT
> >
> > The following works correctly :
> >
> > #if (DEBUG && !COMPACT)
> > #warning Net.Framework (Debug) is defined
> > #elif (!DEBUG && !COMPACT)
> > #warning Net.Framework (Release) is defined
> > #elif (DEBUG && COMPACT)
> > #warning Net.Framework.Compact (Debug) is defined
> > #else
> > #warning Net.Framework.Compact (Release) is defined
> > #endif
> >
> > a Sample of code that will run on both Mashines :
> >
> > #if COMPACT
> > pn_Panel.Capture = true;
> > IntPtr hWnd = Win32Window.GetCapture();
> > pn_Panel.Capture = false;
> > p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
> > #else
> > p_IntPtr = p_Graphics.GetHdc();
> > p_Graphics.ReleaseHdc(p_IntPtr);
> > #endif
> >
> > When shown in VS, the "inactive code" will be grey to show that it will

> not
> > be compiled.
> >
> > Hope this helps
> >
> > Mark Johnson, Berlin Germany
> > (E-Mail Removed)
> >
> >

>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      20th Nov 2003
Take a look at the OpenNETCF IO.Serial library. I used it a lot.

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


"Mark Johnson" <(E-Mail Removed)> wrote in message
news:3fbd0839$0$8775$(E-Mail Removed)...
> But it is not allway possible to compile Framework Code that is not
> supported on the Compact
> - like p_IntPtr = p_Graphics.GetHdc();
> thus here the #ifdefs are usefull.
> Do you have a practical Sample where you would use
> System.Environment.OSVersion.Platform ?
>
> Mark Johnson, Berlin Germany
> (E-Mail Removed)
>
> "Chris Tacke, eMVP" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
> > Since binaries are retargetable, there's no way for the compiler to know
> > what you're going to run the assemby on. Use
> > System.Environment.OSVersion.Platform to decide at run time what to do.
> >
> > --
> > Chris Tacke, eMVP
> > Co-Founder and Advisory Board Member
> > www.OpenNETCF.org
> > ---
> > Windows CE Product Manager
> > Applied Data Systems
> > www.applieddata.net
> >
> >
> > "Mark Johnson" <(E-Mail Removed)> wrote in message
> > news:3fbc61a8$0$8773$(E-Mail Removed)...
> > > >> Also, what are the pre-processor symbols I should use for checking

> for
> > > >> CF/PPC vs. the desktop??
> > > >> (On my continuing quest to get the same apps and libs working on

> > both...)
> > >
> > >
> > > I have not found a standard way of doining this.
> > > There is no pre-processor symbols like DEBUG for this.
> > > I use to the following work around:
> > >
> > > (I am using a German Version, so I am not sure of the English

> > expressions -
> > > would like to have them BTW for Documentation)
> > > Set the following in Framework.Compact Projects :
> > >
> > > \Project\Properties\
> > > Configuration : all configurations
> > > \Configuration Properties\Set pre-processor for Compiling : COMPACT
> > >
> > > The following works correctly :
> > >
> > > #if (DEBUG && !COMPACT)
> > > #warning Net.Framework (Debug) is defined
> > > #elif (!DEBUG && !COMPACT)
> > > #warning Net.Framework (Release) is defined
> > > #elif (DEBUG && COMPACT)
> > > #warning Net.Framework.Compact (Debug) is defined
> > > #else
> > > #warning Net.Framework.Compact (Release) is defined
> > > #endif
> > >
> > > a Sample of code that will run on both Mashines :
> > >
> > > #if COMPACT
> > > pn_Panel.Capture = true;
> > > IntPtr hWnd = Win32Window.GetCapture();
> > > pn_Panel.Capture = false;
> > > p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
> > > #else
> > > p_IntPtr = p_Graphics.GetHdc();
> > > p_Graphics.ReleaseHdc(p_IntPtr);
> > > #endif
> > >
> > > When shown in VS, the "inactive code" will be grey to show that it

will
> > not
> > > be compiled.
> > >
> > > Hope this helps
> > >
> > > Mark Johnson, Berlin Germany
> > > (E-Mail Removed)
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      20th Nov 2003
The problem here is that you need to link against a core. Linking agains
the CF will fail becasue you're calling desktop-only code. If you link to
the desktop core, it will build, but desktop binaries are not retargetable
to the device.

In this case, I don't think there's any possible way to make an assembly
that will run on both platforms (at least not with the framework versions
that are released).

--
Chris Tacke, eMVP
Co-Founder and Advisory Board Member
www.OpenNETCF.org
---
Windows CE Product Manager
Applied Data Systems
www.applieddata.net


"Mark Johnson" <(E-Mail Removed)> wrote in message
news:3fbd0839$0$8775$(E-Mail Removed)...
> But it is not allway possible to compile Framework Code that is not
> supported on the Compact
> - like p_IntPtr = p_Graphics.GetHdc();
> thus here the #ifdefs are usefull.
> Do you have a practical Sample where you would use
> System.Environment.OSVersion.Platform ?
>
> Mark Johnson, Berlin Germany
> (E-Mail Removed)
>
> "Chris Tacke, eMVP" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:(E-Mail Removed)...
> > Since binaries are retargetable, there's no way for the compiler to know
> > what you're going to run the assemby on. Use
> > System.Environment.OSVersion.Platform to decide at run time what to do.
> >
> > --
> > Chris Tacke, eMVP
> > Co-Founder and Advisory Board Member
> > www.OpenNETCF.org
> > ---
> > Windows CE Product Manager
> > Applied Data Systems
> > www.applieddata.net
> >
> >
> > "Mark Johnson" <(E-Mail Removed)> wrote in message
> > news:3fbc61a8$0$8773$(E-Mail Removed)...
> > > >> Also, what are the pre-processor symbols I should use for checking

> for
> > > >> CF/PPC vs. the desktop??
> > > >> (On my continuing quest to get the same apps and libs working on

> > both...)
> > >
> > >
> > > I have not found a standard way of doining this.
> > > There is no pre-processor symbols like DEBUG for this.
> > > I use to the following work around:
> > >
> > > (I am using a German Version, so I am not sure of the English

> > expressions -
> > > would like to have them BTW for Documentation)
> > > Set the following in Framework.Compact Projects :
> > >
> > > \Project\Properties\
> > > Configuration : all configurations
> > > \Configuration Properties\Set pre-processor for Compiling : COMPACT
> > >
> > > The following works correctly :
> > >
> > > #if (DEBUG && !COMPACT)
> > > #warning Net.Framework (Debug) is defined
> > > #elif (!DEBUG && !COMPACT)
> > > #warning Net.Framework (Release) is defined
> > > #elif (DEBUG && COMPACT)
> > > #warning Net.Framework.Compact (Debug) is defined
> > > #else
> > > #warning Net.Framework.Compact (Release) is defined
> > > #endif
> > >
> > > a Sample of code that will run on both Mashines :
> > >
> > > #if COMPACT
> > > pn_Panel.Capture = true;
> > > IntPtr hWnd = Win32Window.GetCapture();
> > > pn_Panel.Capture = false;
> > > p_IntPtr = OpenNETCF.WinAPI.Core.GetDC(hWnd);
> > > #else
> > > p_IntPtr = p_Graphics.GetHdc();
> > > p_Graphics.ReleaseHdc(p_IntPtr);
> > > #endif
> > >
> > > When shown in VS, the "inactive code" will be grey to show that it

will
> > not
> > > be compiled.
> > >
> > > Hope this helps
> > >
> > > Mark Johnson, Berlin Germany
> > > (E-Mail Removed)
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting #ifdef and #ifndef to C# canoewhiteh2o@yahoo.com Microsoft C# .NET 6 25th Nov 2006 10:36 PM
#ifdef in resource file None Microsoft VC .NET 5 16th Jun 2006 02:58 AM
Something like C #ifdef in ASP/ASP.NET olav_net@hotmail.com Microsoft ASP .NET 1 31st May 2005 02:33 PM
Something like C #ifdef in ASP/ASP.NET olav_net@hotmail.com Microsoft ASP .NET 0 30th May 2005 11:40 PM
CF background threads and CF #ifdef's Chris Tacke, eMVP Microsoft Dot NET Compact Framework 3 21st Nov 2003 03:32 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:26 PM.