473,396 Members | 1,789 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,396 software developers and data experts.

How I can find out on which platform I am running (32/64 bits)?

Hi All,

I am building a windows application in VB .Net 2005 , and for deploying
the application i need to run some exe's if it is 32 bits and some
other exe's for 64 bits

Can anyone tell me how can i findout this using VB .Net
Thanks in advance
-Sajin

Dec 22 '06 #1
16 7443
I don't have the code for you, but you will need to use the GetVersionEx API
with the OSVERSIONINFOEX Structure

Use the Environment namespeace to get the basic OS version
(http://support.microsoft.com/kb/3042...icrosoft.com/k
b/304722/en-us) & pass to the above API

You can then find out if its a server/workstation/service pack level...

I hope this is of some use

Newbie Coder
"sajin" <sa***@iprlab.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Hi All,

I am building a windows application in VB .Net 2005 , and for deploying
the application i need to run some exe's if it is 32 bits and some
other exe's for 64 bits

Can anyone tell me how can i findout this using VB .Net
Thanks in advance
-Sajin

Dec 22 '06 #2
Some sample code is here:
http://www.planet-source-code.com/vb...39625&lngWId=1
on Planet Source Code. It's VB6 though. I don't know of anything in
vb.net to get that - there may be, but I personally am just unaware of
any.
Regards,
ImageAnalyst

sajin wrote:
Hi All,

I am building a windows application in VB .Net 2005 , and for deploying
the application i need to run some exe's if it is 32 bits and some
other exe's for 64 bits

Can anyone tell me how can i findout this using VB .Net
Thanks in advance
-Sajin
Dec 22 '06 #3
But with the PSC screen from that code you see that it says things like
Professional/home... That isn't actually breaking it down far enough, is it?
Only the 64 bit is of use there though.

Lets rip the code to pieces & see if we can do a simple translation. Need to
get my VS 6 Enterprise discs out 'cos the upgrade feature in VB.NET ain't
all that, is it?

Newbie Coder
Dec 22 '06 #4
Ok. So here is the answer

'IsWow64Process' API function is declared in Kernall32.dll from XP onwards

' Import
Imports System.Diagnostics

' Declaration
Private Declare Function IsWow64Process Lib "kernel32" (ByVal hProcess As
Int32, ByRef Wow64Process As Boolean) As Int32

' Function
Private Function Is64Bit() As Boolean
Dim proc As Process = Process.GetCurrentProcess
Dim Wow64Process As Boolean
Try
Return IsWow64Process(proc.Id, Wow64Process) <0
Catch ex As Exception
Return False
End Try
End Function

' Usage:
MessageBox.Show(Is64Bit.ToString)

I hope this helps,

Newbie Coder
Dec 22 '06 #5
You didn't look at the whole screenshot. Look at the next line below
the professional/home. It says "64 bit system: False". Presumably it
would say true if you had a 64 bit system, so there must be a way in
the code to detect that.
ImageAnalyst.

Newbie Coder wrote:
But with the PSC screen from that code you see that it says things like
Professional/home... That isn't actually breaking it down far enough, is it?
Only the 64 bit is of use there though.

Lets rip the code to pieces & see if we can do a simple translation. Need to
get my VS 6 Enterprise discs out 'cos the upgrade feature in VB.NET ain't
all that, is it?

Newbie Coder
Dec 23 '06 #6
I saw that, downloaded the VB 6 code, updated it to VB.NET & posted above
your last post

Please read my last post before this one

Newbie Coder
Dec 24 '06 #7
Good! Nice contribution! I'm sure it will be useful to many in the
future as 64 bit systems become more commonplace.
ImageAnalyst.
(By the way, your prior post wasn't there when I replied via Google
Discussion Groups even though you posted it a day before mine. Maybe
there is a lag somewhere.)

Newbie Coder wrote:
I saw that, downloaded the VB 6 code, updated it to VB.NET & posted above
your last post

Please read my last post before this one

Newbie Coder
Dec 26 '06 #8
Hi All,

I got it through the registry entry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\SessionManager\Environment
Read the Key value "PROCESSOR_ARCHITECTURE"

For 32bit it shows - x86
For 64bit it shows- AMD64

Thanks
Sajin
ImageAnalyst wrote:
Good! Nice contribution! I'm sure it will be useful to many in the
future as 64 bit systems become more commonplace.
ImageAnalyst.
(By the way, your prior post wasn't there when I replied via Google
Discussion Groups even though you posted it a day before mine. Maybe
there is a lag somewhere.)

Newbie Coder wrote:
I saw that, downloaded the VB 6 code, updated it to VB.NET & posted above
your last post

Please read my last post before this one

Newbie Coder
Dec 29 '06 #9
That's cool - Nice Work

Newbie Coder

"sajin" <sa***@iprlab.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Hi All,

I got it through the registry entry

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\SessionManager\Environme
nt
Read the Key value "PROCESSOR_ARCHITECTURE"

For 32bit it shows - x86
For 64bit it shows- AMD64

Thanks
Sajin
ImageAnalyst wrote:
Good! Nice contribution! I'm sure it will be useful to many in the
future as 64 bit systems become more commonplace.
ImageAnalyst.
(By the way, your prior post wasn't there when I replied via Google
Discussion Groups even though you posted it a day before mine. Maybe
there is a lag somewhere.)

Newbie Coder wrote:
I saw that, downloaded the VB 6 code, updated it to VB.NET & posted
above
your last post
>
Please read my last post before this one
>
Newbie Coder

Dec 29 '06 #10
There are all these complex answers that I see people giving. There's a much
easier way:

public static bool IsRunningOnWin64()
{
return (IntPtr.Size == 8);
}

In VB this would be:

public shared function IsRunningOnWin64() as boolean
return (IntPtr.Size = 8)
end function

This won't tell you if you're running in WOW on Win64, but it'll let you
know if your app is running in 32 or 64 bit land.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins

"sajin" <sa***@iprlab.comwrote in message
news:11**********************@73g2000cwn.googlegro ups.com...
Hi All,

I am building a windows application in VB .Net 2005 , and for deploying
the application i need to run some exe's if it is 32 bits and some
other exe's for 64 bits

Can anyone tell me how can i findout this using VB .Net
Thanks in advance
-Sajin

Dec 29 '06 #11
Using WMI may have far reaching implications.

I believe that a limited access account won't have sufficient right to run
the WMI select.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW**************@TK2MSFTNGP03.phx.gbl...
Found another way for you

Import the SYSTEM.MANAGEMENT.DLL

' In form Class

Imports System.Management

Dim mos As ManagementObjectSearcher = New
ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
Dim mo As ManagementObject

Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGet.Click
For Each mo In mos.Get
txtSystemType.Text = mo("systemtype").ToString
Next
End Sub
That will return the answer you require too

I have attached the project to this post. So, if you use Outlook Express
you
can download the project zip

I hope this also helps,

Newbie Coder

Dec 29 '06 #12
What's wrong with this?

Debug.WriteLine(My.Computer.Info.OSFullName)
Debug.WriteLine(My.Computer.Info.OSPlatform)
Debug.WriteLine(My.Computer.Info.OSVersion)

"Chris Mullins" <cm******@yahoo.comwrote in message
news:e4**************@TK2MSFTNGP03.phx.gbl...
Using WMI may have far reaching implications.

I believe that a limited access account won't have sufficient right to run
the WMI select.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW**************@TK2MSFTNGP03.phx.gbl...
>Found another way for you

Import the SYSTEM.MANAGEMENT.DLL

' In form Class

Imports System.Management

Dim mos As ManagementObjectSearcher = New
ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
Dim mo As ManagementObject

Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGet.Click
For Each mo In mos.Get
txtSystemType.Text = mo("systemtype").ToString
Next
End Sub
That will return the answer you require too

I have attached the project to this post. So, if you use Outlook Express
you
can download the project zip

I hope this also helps,

Newbie Coder


Dec 30 '06 #13
User never specified VB.NET 2005 code
Dec 30 '06 #14
Found another way for you using WMI:

Add a reference to the SYSTEM.MANAGEMENT.DLL

Then add this Import:

' Import

Imports System.management

' Add a Textbox called 'txtSystemType' & a button called 'btnGet'. Now paste
in the following code:

Dim mos As ManagementObjectSearcher = New
ManagementObjectSearcher("SELECT * FROM Win32_Processor")
Dim mo As ManagementObject

Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGet.Click
For Each mo In mos.Get
txtSystemType.Text = mo("AddressWidth").ToString & " bit"
Next
End Sub

This will then return 32 or 64 & 'bit' to the textbox

I hope this also helps,

Newbie Coder
Dec 30 '06 #15
What??????????????????????
User never specified VB.NET 2005 code

Sure he did. Read his post below. I see VB.Net 2005 is listed there. Don't
you?
>Hi All,
>I am building a windows application in VB .Net 2005 , and for deploying
the application i need to run some exe's if it is 32 bits and some
other exe's for 64 bits
>Can anyone tell me how can i findout this using VB .Net
>Thanks in advance
-Sajin

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:em**************@TK2MSFTNGP02.phx.gbl...
User never specified VB.NET 2005 code


Dec 30 '06 #16
Opps...Ignore this post.

"Mudhead" <no*****@yourhouse.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
What's wrong with this?

Debug.WriteLine(My.Computer.Info.OSFullName)
Debug.WriteLine(My.Computer.Info.OSPlatform)
Debug.WriteLine(My.Computer.Info.OSVersion)

"Chris Mullins" <cm******@yahoo.comwrote in message
news:e4**************@TK2MSFTNGP03.phx.gbl...
>Using WMI may have far reaching implications.

I believe that a limited access account won't have sufficient right to
run the WMI select.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise
http://www.coversant.net/blogs/cmullins

"Newbie Coder" <ne**********@pleasespamme.comwrote in message
news:eW**************@TK2MSFTNGP03.phx.gbl...
>>Found another way for you

Import the SYSTEM.MANAGEMENT.DLL

' In form Class

Imports System.Management

Dim mos As ManagementObjectSearcher = New
ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
Dim mo As ManagementObject

Private Sub btnGet_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGet.Click
For Each mo In mos.Get
txtSystemType.Text = mo("systemtype").ToString
Next
End Sub
That will return the answer you require too

I have attached the project to this post. So, if you use Outlook Express
you
can download the project zip

I hope this also helps,

Newbie Coder



Dec 30 '06 #17

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

Similar topics

1
by: prabu | last post by:
Hello Experts, I am using a HP B.11.11 U 9000/800 machine,I want to learn Python.I have python (2.3.3) installed in it. When I excute python,got the following error,how to correct it?. # python...
1
by: Manoj | last post by:
Hi, I want to know if it is possible to find out through a vb.net application which other applications are running in the background.For example as soon as i load my form I want it to check if a...
15
by: Tor Erik Sønvisen | last post by:
Hi I need a time and space efficient way of storing up to 6 million bits. Time efficency is more important then space efficency as I'm going to do searches through the bit-set. regards tores
53
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
14
by: vib | last post by:
Hi there, union UC32 { unsigned int L; unsigned short S; unsigned char C; } UC32; with the above structure, I am able to shift bits of C, into C, and C into C so on and so forth till C as...
5
by: chellappa | last post by:
hi, i want to find the ruuning time of program using c .. problem: i want to find the running time of program using c , i have one routine in c,,, i want to find how much , its take for...
0
by: pythonhelpneeded | last post by:
While building Python 2.4.3 on SCO OpenServer 5.0.5, I'm getting the error below. The modules mentioned seem to be available in the Lib subdirectory. I've tried setting PYTHONHOME to the build...
0
by: chris | last post by:
I spent hours on this so I hope it helps those that haven't found a solution elsewhere. I kept getting the message "Windows could not start the Background Intelligent Transfer Service on local ...
11
by: John Sheppard | last post by:
Hello there, I am running a webservice on IIS6, sometimes it runs at a reasonable speed, sometimes it runs painfully slow and sometimes inbetween. The application that consumes the service is...
1
by: Johny | last post by:
Is there a way how to find out running processes?E.g. how many Appache's processes are running? Thanks for help. BB.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.