2 using System.Runtime.InteropServices;
\r
3 using Microsoft.Win32;
\r
5 namespace Handbrake.Functions
\r
10 private struct MEMORYSTATUS
\r
12 public UInt32 dwLength;
\r
13 public UInt32 dwMemoryLoad;
\r
14 public UInt32 dwTotalPhys; // Used
\r
15 public UInt32 dwAvailPhys;
\r
16 public UInt32 dwTotalPageFile;
\r
17 public UInt32 dwAvailPageFile;
\r
18 public UInt32 dwTotalVirtual;
\r
19 public UInt32 dwAvailVirtual;
\r
22 [DllImport("kernel32.dll")]
\r
23 private static extern void GlobalMemoryStatus
\r
25 ref MEMORYSTATUS lpBuffer
\r
30 /// Returns the total physical ram in a system
\r
32 /// <returns></returns>
\r
33 public uint TotalPhysicalMemory()
\r
35 MEMORYSTATUS memStatus = new MEMORYSTATUS();
\r
36 GlobalMemoryStatus(ref memStatus);
\r
38 uint MemoryInfo = memStatus.dwTotalPhys;
\r
39 MemoryInfo = MemoryInfo / 1024 / 1024;
\r
45 public Object getCpuCount()
\r
47 RegistryKey RegKey = Registry.LocalMachine;
\r
48 RegKey = RegKey.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
\r
49 return RegKey.GetValue("ProcessorNameString");
\r
52 public System.Windows.Forms.Screen screenBounds()
\r
54 return System.Windows.Forms.Screen.PrimaryScreen;
\r