好久沒寫程式了=口=
一堆API都忘光光~
趁現在重操舊業趕快整理起來吧...
[DllImport("user32.Dll")] private static extern int EnumWindows(EnumWindowsProc x, int y); [DllImport("user32")] private static extern bool EnumChildWindows(IntPtr window, EnumWindowsProc callback, int lParam); [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)] static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow); [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Unicode)] public static extern IntPtr FindWindowByClass(string ClassName, IntPtr Nothing); [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); [DllImport("user32.dll")] static extern short GetKeyState(int nVirtKey); [DllImport("user32.dll")] private static extern Int32 GetWindowText(IntPtr hWnd, StringBuilder lpsb, Int32 count); [DllImport("User32.dll")] public static extern int GetWindowLong(IntPtr hWnd, int index); [DllImport("User32.dll")] public static extern IntPtr GetParent(IntPtr hWnd); [DllImport("user32.dll")] public static extern int GetWindowThreadProcessId(IntPtr handle, out int processId); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] static extern int GetWindowTextLength(IntPtr hWnd); [DllImport("user32.dll")] static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); [DllImport("user32.dll")] static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo); [DllImport("user32")] public static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int dwExtraInfo); [DllImport("user32.dll")] public static extern bool RegisterHotKey( IntPtr hWnd, // handle to window int id, // hot key identifier uint fsModifiers, // key-modifier options Keys vk // virtual-key code ); [DllImport("user32")] public static extern int SetCursorPos(int x, int y); [DllImport("User32.dll")] public static extern Int32 SetForegroundWindow(IntPtr hWnd); [DllImport("user32")] public static extern Int32 SetActiveWindow(IntPtr hWnd); [DllImport("user32.dll", EntryPoint = "SendMessageA")] private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); [DllImport("User32.dll")] public static extern IntPtr SendDlgItemMessage(IntPtr hWnd, int IDDlgItem, int uMsg, int nMaxCount, StringBuilder lpString); [DllImport("user32.dll")] public static extern bool UnregisterHotKey( IntPtr hWnd, // handle to window int id // hot key identifier );
沒有留言:
張貼留言
您可以使用一些 HTML 標記,例如 <b>, <i>, <a>