This sample code from the Microsoft All-In-One Code Framework may answer your question:
Detecting a running process platform in C # (CSPlatformDetector)
The CSPlatformDetector sample code demonstrates the following tasks: related to platform discovery:
- Determine the name of the current operating system. (e.g. "Microsoft Windows 7 Enterprise")
- Detect the version of the current operating system. (for example, "Microsoft Windows NT 6.1.7600.0")
- Determine if the current operating system is a 64-bit operating system.
- Determine if the current process is a 64-bit process.
- Determine if an arbitrary process running on a system is 64-bit.
If you just want to determine if the current running process is a 64-bit process, you can use the Environment.Is64BitProcess property, which is new in .NET. Frames 4.
And if you want to determine whether an arbitrary application is running on the system, this is a 64-bit process, you need to determine the bit of the operating system, and if it is 64-bit, call IsWow64Process() with the handle to the target process:
static bool Is64BitProcess(IntPtr hProcess) { bool flag = false; if (Environment.Is64BitOperatingSystem) {
Scott Ge Sep 04 2018-11-11T00: 00Z
source share