OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / Win32.cs
1 using System;\r
2 using System.Runtime.InteropServices;\r
3 \r
4 namespace Handbrake.Functions\r
5 {\r
6     class Win32\r
7     {\r
8         [DllImport("user32.dll")]\r
9         public static extern bool SetForegroundWindow(int hWnd);\r
10 \r
11         [DllImport("user32.dll")]\r
12         public static extern void LockWorkStation();\r
13 \r
14         [DllImport("user32.dll")]\r
15         public static extern int ExitWindowsEx(int uFlags, int dwReason);\r
16 \r
17         public struct MEMORYSTATUS // Unused var's are required here.\r
18         {\r
19             public UInt32 dwLength;\r
20             public UInt32 dwMemoryLoad;\r
21             public UInt32 dwTotalPhys; // Used\r
22             public UInt32 dwAvailPhys;\r
23             public UInt32 dwTotalPageFile;\r
24             public UInt32 dwAvailPageFile;\r
25             public UInt32 dwTotalVirtual;\r
26             public UInt32 dwAvailVirtual;\r
27         }\r
28 \r
29         [DllImport("kernel32.dll")]\r
30         public static extern void GlobalMemoryStatus\r
31         (\r
32             ref MEMORYSTATUS lpBuffer\r
33         );\r
34 \r
35         [DllImport("kernel32.dll", SetLastError = true)]\r
36         public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId);\r
37 \r
38         public enum ConsoleCtrlEvent\r
39         {\r
40             CTRL_C = 0,\r
41             CTRL_BREAK = 1,\r
42             CTRL_CLOSE = 2,\r
43         }\r
44     }\r
45 }\r