public static NativeStructs.SCROLLINFO GetScrollInfo(Control ctrl, NativeEnums.SB direction) { NativeStructs.SCROLLINFO info = new NativeStructs.SCROLLINFO(); info.cbSize = Marshal.SizeOf(info); info.fMask = (int)NativeEnums.SIF.ALL; NativeMethods.GetScrollInfo(ctrl.Handle, (int)direction, ref info); return info; }
public static IntPtr GetWindowLongPtr(IntPtr hWnd, NativeEnums.GWL nIndex) { if (IntPtr.Size == 8) { return NativeMethods.GetWindowLongPtr64(hWnd, (int)nIndex); } else { return NativeMethods.GetWindowLongPtr32(hWnd, (int)nIndex); } }
private static void SendMouseInput(int x, int y, NativeEnums.MouseEventFlags flag) { NativeStructs.INPUT mouseInput = new NativeStructs.INPUT(); mouseInput.type = NativeEnums.SendInputEventType.InputMouse; mouseInput.mkhi.mi.dx = NativeUtilities.CalculateAbsoluteCoordinateX(x); mouseInput.mkhi.mi.dy = NativeUtilities.CalculateAbsoluteCoordinateY(y); mouseInput.mkhi.mi.mouseData = 0; mouseInput.mkhi.mi.dwFlags = flag | NativeEnums.MouseEventFlags.Absolute; NativeMethods.SendInput(1, ref mouseInput, Marshal.SizeOf(new NativeStructs.INPUT())); }
public static IntPtr SetWindowLongPtr(IntPtr hWnd, NativeEnums.GWL nIndex, IntPtr dwNewLong) { if (IntPtr.Size == 8) { return NativeMethods.SetWindowLongPtr64(hWnd, (int)nIndex, dwNewLong); } else { return new IntPtr(NativeMethods.SetWindowLongPtr32(hWnd, (int)nIndex, dwNewLong.ToInt32())); } }
public static IntPtr OpenProcess(int processid, NativeEnums.ProcessAccess flags) { IntPtr hProcess = NativeMethods.OpenProcess((uint)flags, false, (uint)processid); if (hProcess == IntPtr.Zero) { throw new Win32Exception(); } return hProcess; }
public static IntPtr OpenProcess(Process process, NativeEnums.ProcessAccess flags) { return OpenProcess(process.Id, flags); }
public static extern bool PostMessage(IntPtr hWnd, NativeEnums.WM wMsg, IntPtr wParam, IntPtr lParam);
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, NativeEnums.SetWindowPosition uFlags);
public static extern int TrackPopupMenuEx(IntPtr hmenu, NativeEnums.TPM fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm);
public static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int Y, int cx, int cy, NativeEnums.SWP wFlags);
public static extern IntPtr SendMessage(IntPtr hWnd, NativeEnums.WM wMsg, bool wParam, int lParam);
public static extern IntPtr SendMessage(IntPtr hWnd, NativeEnums.WM wMsg, IntPtr wParam, IntPtr lParam);
public static extern int GetSystemMetrics(NativeEnums.SystemMetric smIndex);