Exemple #1
0
        public static void MouseWheelToCursorPos(MouseEventExtArgs e, int mkKeyState = 0)
        {
            var hWnd   = WinApi.WindowFromPoint(e.Location);
            var wParam = (IntPtr)((e.Delta << 16) | mkKeyState);
            var lParam = (IntPtr)((e.X & 0xFFFF) | (e.Y << 16));

            WinApi.PostMessage(hWnd, WinApi.WM_MOUSEWHEEL, wParam, lParam);
        }
        public static void SwitchLayout(IntPtr hWnd, Language layout) //Смена раскладки
        {
            switch (layout)
            {
            case Language.ru_RU:
                layout = Language.en_US;
                break;

            case Language.en_US:
                layout = Language.ru_RU;
                break;

            default:
                layout = Language.en_US;
                break;
            }
            WinApi.PostMessage(hWnd, WinApi.WM_INPUTLANGCHANGEREQUEST, IntPtr.Zero,
                               WinApi.LoadKeyboardLayout(string.Format("{0:X8}", (int)layout), WinApi.KLF_ACTIVATE));
        }
 public static void SetLayout(IntPtr hWnd, Language layout)
 {
     WinApi.PostMessage(hWnd, WinApi.WM_INPUTLANGCHANGEREQUEST, IntPtr.Zero,
                        WinApi.LoadKeyboardLayout(string.Format("{0:X8}", (int)layout), WinApi.KLF_ACTIVATE));
 }