/* win32.cs $ This file is part of the HandBrake source code. Homepage: . It may be used under the terms of the GNU General Public License. */ namespace Handbrake.Functions { using System; using System.Runtime.InteropServices; /// /// Win32 API calls /// public class Win32 { /// /// Set the Forground Window /// /// /// The h wnd. /// /// /// A Boolean true when complete. /// [DllImport("user32.dll")] public static extern bool SetForegroundWindow(int hWnd); /// /// Lock the workstation /// [DllImport("user32.dll")] public static extern void LockWorkStation(); /// /// Exit Windows /// /// /// The u flags. /// /// /// The dw reason. /// /// /// an integer /// [DllImport("user32.dll")] public static extern int ExitWindowsEx(int uFlags, int dwReason); /// /// System Memory Status /// public struct MEMORYSTATUS // Unused var's are required here. { public UInt32 dwLength; public UInt32 dwMemoryLoad; public UInt32 dwTotalPhys; // Used public UInt32 dwAvailPhys; public UInt32 dwTotalPageFile; public UInt32 dwAvailPageFile; public UInt32 dwTotalVirtual; public UInt32 dwAvailVirtual; } /// /// Global Memory Status /// /// /// The lp buffer. /// [DllImport("kernel32.dll")] public static extern void GlobalMemoryStatus ( ref MEMORYSTATUS lpBuffer ); [DllImport("kernel32.dll", SetLastError = true)] public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId); /// /// Console Ctrl Event /// public enum ConsoleCtrlEvent { CTRL_C = 0, CTRL_BREAK = 1, CTRL_CLOSE = 2, } } }