コード例 #1
0
ファイル: NativeUtilities.cs プロジェクト: TGOSeraph/StUtil
 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;
 }
コード例 #2
0
ファイル: NativeUtilities.cs プロジェクト: TGOSeraph/StUtil
 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);
     }
 }
コード例 #3
0
        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()));
        }
コード例 #4
0
ファイル: NativeUtilities.cs プロジェクト: TGOSeraph/StUtil
 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()));
     }
 }
コード例 #5
0
ファイル: NativeUtilities.cs プロジェクト: TGOSeraph/StUtil
        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;
        }
コード例 #6
0
ファイル: NativeUtilities.cs プロジェクト: TGOSeraph/StUtil
 public static IntPtr OpenProcess(Process process, NativeEnums.ProcessAccess flags)
 {
     return OpenProcess(process.Id, flags);
 }
コード例 #7
0
 public static extern bool PostMessage(IntPtr hWnd, NativeEnums.WM wMsg, IntPtr wParam, IntPtr lParam);
コード例 #8
0
 public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, NativeEnums.SetWindowPosition uFlags);
コード例 #9
0
 public static extern int TrackPopupMenuEx(IntPtr hmenu, NativeEnums.TPM fuFlags, int x, int y, IntPtr hwnd, IntPtr lptpm);
コード例 #10
0
 public static extern IntPtr SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int Y, int cx, int cy, NativeEnums.SWP wFlags);
コード例 #11
0
 public static extern IntPtr SendMessage(IntPtr hWnd, NativeEnums.WM wMsg, bool wParam, int lParam);
コード例 #12
0
 public static extern IntPtr SendMessage(IntPtr hWnd, NativeEnums.WM wMsg, IntPtr wParam, IntPtr lParam);
コード例 #13
0
 public static extern int GetSystemMetrics(NativeEnums.SystemMetric smIndex);