.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> System Process >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

how to check the processor is 32 bit or 64 bit

Posted By:Amit Mehra       Posted Date: March 22, 2013    Points: 40    Category: System Process    URL: http://www.dotnetspark.com  

Below code in C# and VB.Net to check the processor is 32 bit or 64 bit in .NET Framework in windows application or ASP.Net
 

Sometime you need to know the process weather the process is 64 bit or 32 bit. Using .NET Framework its very easy to know the current process is 32 bit or 64 bit.

Using Environment Class and its Is64BitProcess properties will tell us that

below if the code to find out the current process version

C# Code


try
{
    bool is32BitProcessor = Environment.Is64BitProcess;

    if (is32BitProcessor)
    {
        MessageBox.Show("Current Processor is 32 bit Processor");
    }
    else
    {
        MessageBox.Show("Current Processor is 64 bit Processor");
    }
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}

VB.Code


Try
	Dim is32BitProcessor As Boolean = Environment.Is64BitProcess

	If is32BitProcessor Then
		MessageBox.Show("Current Processor is 32 bit Processor")
	Else
		MessageBox.Show("Current Processor is 64 bit Processor")
	End If
Catch ex As Exception
	MessageBox.Show(ex.Message)
End Try


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend