/* 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. { /// /// Unknown /// public UInt32 dwLength; /// /// Memory Load /// public UInt32 dwMemoryLoad; /// /// Total Physical Memory /// public UInt32 dwTotalPhys; // Used /// /// Available Physical Memory /// public UInt32 dwAvailPhys; /// /// Total Page File /// public UInt32 dwTotalPageFile; /// /// Available Page File /// public UInt32 dwAvailPageFile; /// /// Total Virtual Memory /// public UInt32 dwTotalVirtual; /// /// Available Virtual Memory /// public UInt32 dwAvailVirtual; } /// /// Global Memory Status /// /// /// The lp buffer. /// [DllImport("kernel32.dll")] public static extern void GlobalMemoryStatus ( ref MEMORYSTATUS lpBuffer ); /// /// Generate a Console Ctrl Event /// /// /// The sigevent. /// /// /// The dw process group id. /// /// /// Bool true is sucess /// [DllImport("kernel32.dll", SetLastError = true)] public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId); /// /// Console Ctrl Event /// public enum ConsoleCtrlEvent { /// /// Ctrl - C /// CTRL_C = 0, /// /// Ctrl - Break /// CTRL_BREAK = 1, /// /// Ctrl - Close /// CTRL_CLOSE = 2, } } }