473,320 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How do I detect if my .net application is running in 64 bit mode

Is there a function which returns is my application is in 64 bit mode?

-Martijn
Aug 21 '06 #1
4 5104
I would imagine that you could just take the size of a reference (if 4 bytes
= 32 if 8 bytes = 64) although there might be a method somewhere that
already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
Is there a function which returns is my application is in 64 bit mode?

-Martijn


Aug 21 '06 #2
You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere that
already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
>Is there a function which returns is my application is in 64 bit mode?

-Martijn



Aug 21 '06 #3
That's smart. Thanks for the answer.

Greetings,
Martijn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:%2****************@TK2MSFTNGP04.phx.gbl...
You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere
that already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
>>Is there a function which returns is my application is in 64 bit mode?

-Martijn




Aug 21 '06 #4
btw this code works fine:

public static bool Is64BitMode()
{
return System.Runtime.InteropServices.Marshal.SizeOf(type of(IntPtr))
== 8;
}

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:ev**************@TK2MSFTNGP02.phx.gbl...
That's smart. Thanks for the answer.

Greetings,
Martijn

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote
in message news:%2****************@TK2MSFTNGP04.phx.gbl...
> You can just check the static Size property on the IntPtr class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Greg Young" <dr*******************@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>>I would imagine that you could just take the size of a reference (if 4
bytes = 32 if 8 bytes = 64) although there might be a method somewhere
that already does this.

Cheers,

Greg

"Martijn Boven" <ma*****@daxis.nlwrote in message
news:Ok**************@TK2MSFTNGP06.phx.gbl...
Is there a function which returns is my application is in 64 bit mode?

-Martijn




Aug 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Daniel Loose | last post by:
Hello, in order to use my scripts developed at home directly after upload, I wish to define a variable $root at begin of each script in a way that it always - be it here at home or on any other...
1
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is...
6
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
6
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
5
by: Barry Mossman | last post by:
Hi, can I detect whether my class is running within the context of a Console application, vs say a WinForm's application ? also does anyone know whether the compiler or runtime is smart enough...
9
by: Wayne Wengert | last post by:
I built an ASP application and it runs fine on my local IIS. I am trying to move the application to my web service (ISP) out on the internet. I've read several of the help articles but they all...
5
by: Lara | last post by:
Hi, I am getting the following error. All the files are stored in a directory named 'web' as told by the Server Administrtor can anyone help me Server Error in '/' Application....
0
by: MIke Kansky | last post by:
I need to detect when user's computer goes to idle mode. I also need to detect when user's computer comes back from the idle mode. I have an application running in Sys Tray that should let the...
15
by: Eric Renken | last post by:
Is there something in System.Environment that can tell me if the program is running on a 64bit OS? What I am thinking is right now is to check the size of IntPtr and if it is 4 then it is 32bit,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.