![]() |
Sylloge
A C# helper library
|
00001 using System; 00002 using System.Collections.Generic; 00003 using System.Linq; 00004 using System.Runtime.InteropServices; 00005 using System.Text; 00006 00007 namespace Sylloge 00008 { 00009 public static partial class WinAPI 00010 { 00011 public static class User32 00012 { 00013 #region User32 00014 00015 [DllImport("User32.dll", SetLastError = true)] 00016 public static extern int UnhookWindowsHookEx(IntPtr hHook); 00017 00018 [DllImport("User32.dll", SetLastError = true)] 00019 public static extern int GetAsyncKeyState(int vKey); 00020 00021 [DllImport("user32.dll")] 00022 public static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); 00023 00024 [DllImport("user32.dll")] 00025 public static extern int GetMenuItemCount(IntPtr hMenu); 00026 00027 [DllImport("user32.dll")] 00028 public static extern bool DrawMenuBar(IntPtr hWnd); 00029 00030 [DllImport("user32.dll")] 00031 public static extern bool RemoveMenu(IntPtr hMenu, uint uPosition, uint uFlags); 00032 00033 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 00034 public static extern bool SetWindowText(IntPtr hwnd, String lpString); 00035 00036 [DllImport("user32.dll")] 00037 [return: MarshalAs(UnmanagedType.Bool)] 00038 public static extern bool SetForegroundWindow(IntPtr hWnd); 00039 00040 [DllImport("user32.dll", SetLastError = true)] 00041 public static extern IntPtr SetActiveWindow(IntPtr hWnd); 00042 00043 [DllImport("user32.dll", SetLastError = true)] 00044 public static extern uint SendInput(uint nInputs, ref LowLevelInput pInputs, int cbSize); 00045 00046 [DllImport("user32.dll")] 00047 public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); 00048 00049 [DllImport("user32.dll", SetLastError = true)] 00050 public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); 00051 00052 [DllImport("user32.dll", SetLastError = true)] 00053 public static extern int SetWindowLong(IntPtr hwnd, int index, uint dwNewLong); 00054 00055 [DllImport("user32.dll", SetLastError = true)] 00056 public static extern int FindWindow(string lpClassName, string lpWindowName); 00057 00058 [DllImport("user32.dll", SetLastError = true)] 00059 public static extern IntPtr GetDesktopWindow(); 00060 00061 [DllImport("user32.dll", SetLastError = true)] 00062 public static extern IntPtr GetWindowDC(IntPtr hWnd); 00063 00064 [DllImport("user32.dll", SetLastError = true)] 00065 public static extern IntPtr GetWindowRect(IntPtr hWnd, ref Rectangle rect); 00066 00067 [DllImport("user32.dll", SetLastError = true)] 00068 public static extern uint GetWindowLong(IntPtr hWnd, int nIndex); 00069 00070 [DllImport("user32.dll", SetLastError = true)] 00071 public static extern IntPtr GetForegroundWindow(); 00072 00073 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 00074 public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); 00075 00076 [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] 00077 public static extern int GetWindowTextLength(IntPtr hWnd); 00078 00079 [DllImport("user32.dll")] 00080 [return: MarshalAs(UnmanagedType.Bool)] 00081 public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); 00082 00083 [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] 00084 public static extern IntPtr GetDC(IntPtr hWnd); 00085 00086 [DllImport("user32.dll", ExactSpelling = true)] 00087 public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); 00088 00089 [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)] 00090 public static extern int UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref Point pptDst, ref Size psize, IntPtr hdcSrc, ref Point pptSrc, Int32 crKey, ref BlendFunction pblend, Int32 dwFlags); 00091 00092 [DllImport("user32.dll", SetLastError = true)] 00093 [return: MarshalAs(UnmanagedType.Bool)] 00094 public static extern bool DestroyWindow(IntPtr hwnd); 00095 00096 [DllImport("user32.dll", SetLastError = true)] 00097 public static extern IntPtr GetMenu(IntPtr hWnd); 00098 00099 [DllImport("user32.dll", SetLastError = true)] 00100 public static extern bool SetMenu(IntPtr hWnd, IntPtr hMenu); 00101 00102 [DllImport("user32.dll")] 00103 public static extern bool RedrawWindow(IntPtr hWnd, [In] ref Rectangle lprcUpdate, IntPtr hrgnUpdate, uint flags); 00104 00105 [DllImport("user32.dll")] 00106 [return: MarshalAs(UnmanagedType.Bool)] 00107 public static extern bool GetIconInfo(IntPtr hIcon, ref IconInfo pIconInfo); 00108 00109 [DllImport("user32.dll")] 00110 public static extern IntPtr CreateIconIndirect(ref IconInfo icon); 00111 00112 [DllImport("user32.dll")] 00113 public static extern IntPtr SendMessageW(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); 00114 00115 [DllImport("winmm.dll", SetLastError = true, CharSet = CharSet.Auto)] 00116 public static extern uint waveOutGetVolume(IntPtr hwo, ref IntPtr dwVolume); 00117 00118 #endregion 00119 } 00120 } 00121 }