OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / Win32.cs
1 /*  win32.cs $\r
2         \r
3            This file is part of the HandBrake source code.\r
4            Homepage: <http://handbrake.fr>.\r
5            It may be used under the terms of the GNU General Public License. */\r
6 \r
7 \r
8 using System;\r
9 using System.Runtime.InteropServices;\r
10 \r
11 namespace Handbrake.Functions\r
12 {\r
13     class Win32\r
14     {\r
15         [DllImport("user32.dll")]\r
16         public static extern bool SetForegroundWindow(int hWnd);\r
17 \r
18         [DllImport("user32.dll")]\r
19         public static extern void LockWorkStation();\r
20 \r
21         [DllImport("user32.dll")]\r
22         public static extern int ExitWindowsEx(int uFlags, int dwReason);\r
23 \r
24         public struct MEMORYSTATUS // Unused var's are required here.\r
25         {\r
26             public UInt32 dwLength;\r
27             public UInt32 dwMemoryLoad;\r
28             public UInt32 dwTotalPhys; // Used\r
29             public UInt32 dwAvailPhys;\r
30             public UInt32 dwTotalPageFile;\r
31             public UInt32 dwAvailPageFile;\r
32             public UInt32 dwTotalVirtual;\r
33             public UInt32 dwAvailVirtual;\r
34         }\r
35 \r
36         [DllImport("kernel32.dll")]\r
37         public static extern void GlobalMemoryStatus\r
38         (\r
39             ref MEMORYSTATUS lpBuffer\r
40         );\r
41 \r
42         [DllImport("kernel32.dll", SetLastError = true)]\r
43         public static extern bool GenerateConsoleCtrlEvent(ConsoleCtrlEvent sigevent, int dwProcessGroupId);\r
44 \r
45         public enum ConsoleCtrlEvent\r
46         {\r
47             CTRL_C = 0,\r
48             CTRL_BREAK = 1,\r
49             CTRL_CLOSE = 2,\r
50         }\r
51     }\r
52 }\r