Click here to Skip to main content
15,886,026 members
Home / Discussions / C#
   

C#

 
GeneralRe: Registry.OpenSubKey Returns Null Pin
SledgeHammer018-May-12 8:01
SledgeHammer018-May-12 8:01 
GeneralRe: Registry.OpenSubKey Returns Null Pin
Kevin Marois8-May-12 10:58
professionalKevin Marois8-May-12 10:58 
GeneralRe: Registry.OpenSubKey Returns Null Pin
SledgeHammer018-May-12 11:23
SledgeHammer018-May-12 11:23 
GeneralRe: Registry.OpenSubKey Returns Null Pin
Richard MacCutchan8-May-12 8:13
mveRichard MacCutchan8-May-12 8:13 
GeneralRe: Registry.OpenSubKey Returns Null Pin
Kevin Marois8-May-12 10:57
professionalKevin Marois8-May-12 10:57 
GeneralRe: Registry.OpenSubKey Returns Null Pin
Richard MacCutchan8-May-12 21:27
mveRichard MacCutchan8-May-12 21:27 
QuestionDisplay Target Platform Pin
AnneThorne7-May-12 6:19
AnneThorne7-May-12 6:19 
AnswerRe: Display Target Platform Pin
Jeremy Hutchinson7-May-12 6:52
professionalJeremy Hutchinson7-May-12 6:52 
The whole idea of the 'Any CPU' setting is that it runs on both x86 (32 bit) and x64 (64 bit). Unless you're running into a specific problem that can be resolved by selecting x86 or x64, you should probably leave that setting on Any CPU.

Now to answer your actual question:
If you build x86, you will then IntPtr.Size will be 4. If you build x64 IntPtr.Size will be 8. If you build Any CPU, IntPtr.Size will be 4 on 32 bit windows and 8 on 64 bit windows. So that won't help identify the Any CPU compiler setting.

So, you would need to create 3 project files (2 copies of the original), then add a Conditional Compilation Symbol in each of the project files. Then set the Label's text based on those symbols.

C#
string platformTarget = "unknown";
#if x86
    platformTarget = "x86";
#elif x64
    platformTarget = "x64";
#elif AnyCPU
    platformTarget = "AnyCPU";
#endif
    lblPlatformTarget = platformTarget; 


You can do something similar with comparing Framework 2 and 4. The upgrade from 2 to 4 should be completely painless.

AnswerRe: Display Target Platform Pin
Apocalypse Now7-May-12 15:02
Apocalypse Now7-May-12 15:02 
GeneralRe: Display Target Platform Pin
Luc Pattyn8-May-12 2:31
sitebuilderLuc Pattyn8-May-12 2:31 
GeneralRe: Display Target Platform Pin
Apocalypse Now8-May-12 14:26
Apocalypse Now8-May-12 14:26 
AnswerRe: Display Target Platform Pin
Luc Pattyn8-May-12 14:56
sitebuilderLuc Pattyn8-May-12 14:56 
GeneralRe: Display Target Platform Pin
Apocalypse Now8-May-12 15:22
Apocalypse Now8-May-12 15:22 
AnswerRe: Display Target Platform Pin
Bernhard Hiller8-May-12 0:16
Bernhard Hiller8-May-12 0:16 
QuestionBest practice Pin
mo5andes7-May-12 5:42
mo5andes7-May-12 5:42 
AnswerRe: Best practice Pin
Eddy Vluggen7-May-12 5:58
professionalEddy Vluggen7-May-12 5:58 
AnswerRe: Best practice Pin
Not Active7-May-12 6:12
mentorNot Active7-May-12 6:12 
GeneralRe: Best practice Pin
PIEBALDconsult7-May-12 6:14
mvePIEBALDconsult7-May-12 6:14 
GeneralRe: Best practice Pin
Jeremy Hutchinson7-May-12 6:55
professionalJeremy Hutchinson7-May-12 6:55 
GeneralRe: Best practice Pin
Not Active7-May-12 7:29
mentorNot Active7-May-12 7:29 
AnswerRe: Best practice Pin
PIEBALDconsult7-May-12 6:13
mvePIEBALDconsult7-May-12 6:13 
AnswerRe: Best practice Pin
Jeremy Hutchinson7-May-12 7:03
professionalJeremy Hutchinson7-May-12 7:03 
GeneralRe: Best practice Pin
PIEBALDconsult7-May-12 7:38
mvePIEBALDconsult7-May-12 7:38 
GeneralRe: Best practice Pin
Jeremy Hutchinson7-May-12 8:39
professionalJeremy Hutchinson7-May-12 8:39 
GeneralRe: Best practice Pin
Not Active7-May-12 10:14
mentorNot Active7-May-12 10:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.