protected override void ProcessRawInput(WindowsMessages message, IntPtr lParam) { var data = RawInputProcessor.Keyboard.Transform( message, Marshal.PtrToStructure <KBDLLHOOKSTRUCT>(lParam)); RawInputProcessed?.Invoke(data); }
/// <summary> /// Sends the specified message to a window or windows. The SendMessage function calls the /// window procedure for the specified window and does not return until the window procedure /// has processed the message. /// </summary> /// <param name="hwnd">The window handle of the sending window</param> /// <param name="windowMessage">The message to be sent.</param> /// <param name="wParam">Additional message-specific information.</param> /// <param name="lParam">Additional message-specific information.</param> public static void SendMessage(IntPtr hwnd, WindowsMessages windowMessage, IntPtr wParam, IntPtr lParam) { if (UnsafeNative.SendMessage(hwnd, (int)windowMessage, wParam, lParam) != 0) { throw new Win32Exception(Marshal.GetLastWin32Error()); } }
/// <summary> /// Sends the message. /// </summary> /// <param name="key"> /// The key. /// </param> /// <param name="message"> /// The message. /// </param> public static void SendMessage(uint key, WindowsMessages message, WndEventComposition args) { foreach (var menu in RootMenus) { menu.Value.OnReceiveMessage(message, Utils.GetCursorPos(), key, args); } }
public override string ToString() { string msgName = WindowsMessages.GetNameByValue(Msg); string M = (msgName == null) ? Msg.ToString() : $"WM_{msgName}({Msg})"; return($"<{M}[0x{Msg.ToString("x")}], {wParam}[0x{wParam.ToString("x")}], {lParam}[0x{lParam.ToString("x")}]>"); }
/// <summary> /// Window Proc /// </summary> /// <param name="hWnd"></param> /// <param name="msg"></param> /// <param name="wParam"></param> /// <param name="lParam"></param> /// <returns></returns> private static IntPtr WindowProc(IntPtr hWnd, WindowsMessages msg, UIntPtr wParam, IntPtr lParam) { try { switch (msg) { case WindowsMessages.WM_DESTROY: PostQuitMessage(0); return(IntPtr.Zero); case WindowsMessages.WM_DPICHANGED: SetPositionAndSize((int)(wParam.ToUInt32() >> 16)); DrawImage(); return(IntPtr.Zero); case WindowsMessages.WM_NCHITTEST: var result = DefWindowProc(hWnd, msg, wParam, lParam); return(result == (IntPtr)HitTestResults.HTCAPTION ? (IntPtr)HitTestResults.HTNOWHERE : result); default: return(DefWindowProc(hWnd, msg, wParam, lParam)); } } catch { //The finally in Main won't run if exception is thrown in this method. //This may be because this method was called by system code. //So we must handle exception here. DestroyWindow(_window); return(IntPtr.Zero); } }
public void IsLogin(String user) { WindowsMessages w = new WindowsMessages(); //Go to Desk Page _reportingTasks.CreateNode("User Authorization action"); Goto(_config.PlmUrl); SeleniumGetMethod.WaitForPageLoad(driver); //If User not login if (driver.Url.IndexOf("plmOn/Desk/", StringComparison.OrdinalIgnoreCase) == -1) { SeleniumGetMethod.WaitForPageLoad(driver); //Go to Login page driver.Navigate().GoToUrl(_config.PlmUrlDef); var pagelogin = _pages.GetPage <LoginPageObjects>(); pagelogin.Login(user, _config.Password); _reportingTasks.Log(Status.Info, user + " Login in the system"); SeleniumGetMethod.WaitForPageLoad(driver); } else { if (browserName == "Edge") { driver.ExecuteJavaScript(@"window.onbeforeunload = function(){}"); } } }
public void Process( ref MouseInput input, WindowsMessages msg, MSLLHOOKSTRUCT msllhookstruct) { input.State = GetState(msg); }
/// <summary> /// /// </summary> /// <param name="code"></param> /// <param name="wParam"></param> /// <param name="lParam"></param> /// <returns></returns> public Int32 MyMouseCallBack(Int32 code, WindowsMessages wParam, MSLLHOOKSTRUCT lParam) { if (code < 0) { return(NativeMethod.CallNextHookEx(IntPtr.Zero, code, wParam, lParam)); } switch (wParam) { case WindowsMessages.WM_MOUSEMOVE: if (MouseMove == null) { break; } MouseMove(lParam.pt.X, lParam.pt.Y); break; case WindowsMessages.WM_LBUTTONDOWN: if (MouseLeftDown == null) { break; } MouseLeftDown(lParam.pt.X, lParam.pt.Y); break; } // キーの処理を次に回して完了。 return(NativeMethod.CallNextHookEx(IntPtr.Zero, code, wParam, lParam)); }
public static extern UIntPtr SendMessageTimeoutText( IntPtr hWnd, WindowsMessages Msg, // Use WM_GETTEXT IntPtr countOfChars, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder text, SendMessageTimeoutFlags flags, uint timeout, out IntPtr result);
public static extern IntPtr SendMessageTimeout( IntPtr hWnd, WindowsMessages Msg, IntPtr wParam, IntPtr lParam, SendMessageTimeoutFlags flags, uint timeout, out IntPtr result);
public virtual void CheckSearch() { foreach (var drl in SearchFormDropDowns) { SeleniumSetMethods.SelectDropDown(drl, 1); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(2000); } foreach (var field in SearchFormInputs) { field.SendKeys(Helpers.Randomizer.String(7)); } SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(3000); for (int i = 0; i < SearchFormCreatedDate.Count; i++) { SeleniumGetMethod.WaitForElement(driver, SearchFormCreatedDate[i]); SearchFormCreatedDate[i].Click(); try { foreach (var date in CalendarBoxFromTo) { if (date.Displayed) { date.Clear(); date.SendKeys(WindowsMessages.GetCurDate(1)); SeleniumGetMethod.WaitForPageLoad(driver); } } if (BtnApply[i].Displayed) { SeleniumGetMethod.WaitForElement(driver, BtnApply[i]); BtnApply[i].Click(); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(1000); SeleniumGetMethod.WaitForPageLoad(driver); } } catch (Exception msg) { PropertiesCollection._reportingTasks.Log(Status.Info, "Can't manipulate calendarboxes..<br>" + msg.ToString()); } } Thread.Sleep(2000); BtnSearch.Click(); SeleniumGetMethod.WaitForPageLoad(driver); Thread.Sleep(2000); try { xClearAllFilters.Click(); Thread.Sleep(2000); } catch (Exception msg) { PropertiesCollection._reportingTasks.Log(Status.Info, "Can't set null filters uisng x(cross) link...<br>" + msg.ToString()); } SeleniumGetMethod.WaitForPageLoad(driver); }
private void HandleCancelClick(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONUP || !SequenceLevlerGUI.Cancel.Sprite.Visible) { return; } if (Common.IsInside(cursorPos, SequenceLevlerGUI.Cancel.Sprite.Position, SequenceLevlerGUI.Cancel.Bitmap.Width, SequenceLevlerGUI.Cancel.Bitmap.Height)) { ResetMenuEntries(); } }
// System Message Handler private static IntPtr MessageHandler(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam) { switch (msg) { case WindowsMessages.CLOSE: Win32API.PostQuitMessage(0); break; } IntPtr result = Win32API.DefWindowProc(hWnd, msg, wParam, lParam); return result; }
public static IntPtr SendMessageW( HandleRef hWnd, WindowsMessages Msg, IntPtr wParam = default, IntPtr lParam = default) { var result = SendMessageW(hWnd.Handle, Msg, wParam, lParam); GC.KeepAlive(hWnd.Wrapper); return(result); }
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN || !SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinNameLoadingButton").GetValue <KeyBind>().Active) { return; } int active = GetActiveIndex(); System.Drawing.Point mainPos = new System.Drawing.Point((int)MainFrame.Position.X, (int)MainFrame.Position.Y); System.Drawing.Point chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[active].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[active].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Bitmap.Height)) { return; } for (int i = active - 1; i >= 0; i--) { chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[i].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[i].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue <StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } for (int i = active + 1; i < ChampSkinGUI.ChampSkins.Length; i++) { chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[i].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[i].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue <StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } }
public MessageLoop(WindowsMessages Filter) : base() { filter = (int)Filter; base.FormBorderStyle = FormBorderStyle.FixedToolWindow; base.ShowInTaskbar = false; base.StartPosition = FormStartPosition.Manual; base.Location = new System.Drawing.Point(-2000, -2000); base.Size = new System.Drawing.Size(1, 1); base.Show(); }
private IntPtr HookCallback(int nCode, WindowsMessages wParam, KBDLLHOOKSTRUCT lParam) { if (nCode >= 0 && wParam == WindowsMessages.WM_KEYDOWN || wParam == WindowsMessages.WM_SYSKEYDOWN) { OnKeyDown.Invoke(this, ((Keys)lParam.vkCode)); } else if (nCode >= 0 && wParam == WindowsMessages.WM_KEYUP || wParam == WindowsMessages.WM_SYSKEYUP) { OnKeyUp.Invoke(this, ((Keys)lParam.vkCode)); } return(User.CallNextHookEx(_hookID, nCode, wParam, lParam)); }
/// <summary> /// Handler to run on mouse change. /// </summary> /// <param name="nCode">Event code.</param> /// <param name="wParam">Type of windows message.</param> /// <param name="lParam">Keyboard status struct.</param> /// <returns>Pointer to next callback.</returns> private IntPtr LowLevelMouseHook(int nCode, WindowsMessages wParam, IntPtr lParam) { MouseLowLevelHookStruct mouse = (MouseLowLevelHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseLowLevelHookStruct)); if (nCode >= 0 && FromAllowedWindow()) { LastMessageReceived = DateTime.Now; RaiseEvent(BuildEventArgs(wParam, mouse)); } return(WinApi.User32.Api.CallNextHookEx(_hook, nCode, (IntPtr)wParam, lParam)); }
public WndEventComposition(WndEventArgs wndEventArgs) { this.wndEventArgs = wndEventArgs; this.Char = Convert.ToChar((wndEventArgs.WParam <= char.MaxValue) ? wndEventArgs.WParam : 0); this.Key = (Keys)((int)wndEventArgs.WParam); this.FullKey = (Keys)((int)wndEventArgs.WParam); this.Msg = (WindowsMessages)wndEventArgs.Msg; var bytes = BitConverter.GetBytes(wndEventArgs.WParam); this.SideButton = (bytes.Length > 2) ? bytes[2] == 1 ? Keys.XButton1 : bytes[2] == 2 ? Keys.XButton2 : Keys.None : Keys.None; }
/// <summary> /// Also used in the MainForm WndProc /// </summary> /// <param name="m">Message</param> /// <returns>true if the message should be filtered</returns> public static bool PreFilterMessageExternal(ref Message m) { WindowsMessages message = (WindowsMessages)m.Msg; if (message == WindowsMessages.WM_INPUTLANGCHANGEREQUEST || message == WindowsMessages.WM_INPUTLANGCHANGE) { LOG.WarnFormat("Filtering: {0}, {1:X} - {2:X} - {3:X}", message, m.LParam.ToInt64(), m.WParam.ToInt64(), m.HWnd.ToInt64()); // For now we always return true return(true); // But it could look something like this: //return (m.LParam.ToInt64() | 0x7FFFFFFF) != 0; } return(false); }
public void PopUpDetectorCheck() { Thread.Sleep(3000); var pageAccounts = _pages.GetPage <PageObjectAccounts>(); WindowsMessages messages = new WindowsMessages(); pageAccounts.BtnNew.Click(); messages.IsPopUpVisible(pageAccounts.PopUpDetector); pageAccounts.BtnCloseCross.Click(); messages.IsPopUpVisible(pageAccounts.PopUpDetector); pageAccounts.BtnNew.Click(); messages.IsPopUpVisible(pageAccounts.PopUpDetector); pageAccounts.BtnCloseCross.Click(); messages.IsPopUpVisible(pageAccounts.PopUpDetector); }
public void Process( ref MouseInput input, WindowsMessages windowsMessage, MSLLHOOKSTRUCT hookStruct) { if (input.Key != MouseKeys.XBUTTON1) { return; } if (ProcessorHelpers.HIWORD(hookStruct.mouseData) == 0x2) { input.Key = MouseKeys.XBUTTON2; } }
/// <summary> /// Initializes static members of the <see cref="WndEventComposition" /> struct. /// </summary> /// <param name="wndEventArgs"> /// The <see cref="WndEventArgs" /> /// </param> //[PermissionSet(SecurityAction.Assert, Unrestricted = true)] public WndEventComposition(WndEventArgs wndEventArgs) { this.wndEventArgs = wndEventArgs; this.Char = Convert.ToChar((wndEventArgs.WParam <= char.MaxValue) ? wndEventArgs.WParam : 0); this.Key = (Keys)((int)wndEventArgs.WParam); this.FullKey = (Keys)((int)wndEventArgs.WParam); this.Msg = (WindowsMessages)wndEventArgs.Msg; var bytes = BitConverter.GetBytes(wndEventArgs.WParam); this.SideButton = (bytes.Length > 2) ? bytes[2] == 1 ? Keys.XButton1 : bytes[2] == 2 ? Keys.XButton2 : Keys.None : Keys.None; }
private void HandleCancelClick(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONUP) { return; } if (Common.IsInside( cursorPos, new Point((int)(this.MainFrame.Position.X + this.MainBitmap.Bitmap.Width - this.CancelBitmap.Bitmap.Width), (int)(this.MainFrame.Position.Y + this.MainBitmap.Bitmap.Height - this.CancelBitmap.Bitmap.Height)), CancelBitmap.Bitmap.Width, CancelBitmap.Bitmap.Height)) { ResetMenuEntries(); } }
internal TOutput Transform(WindowsMessages message, TInput input) { var valueTransformation = new ValueTransformation <TInput, TOutput>() { Message = message, Input = input, Output = new TOutput() }; foreach (var step in ProcessingSteps) { valueTransformation = step.Process(valueTransformation); } return(valueTransformation.Output); }
public WndEventComposition(WndEventArgs wndEventArgs) { this.wndEventArgs = wndEventArgs; Char = Convert.ToChar(wndEventArgs.WParam <= char.MaxValue ? wndEventArgs.WParam : 0); Key = (Keys)(int)wndEventArgs.WParam; FullKey = (Keys)(int)wndEventArgs.WParam != ModifierKeys ? (Keys)(int)wndEventArgs.WParam | ModifierKeys : (Keys)(int)wndEventArgs.WParam; Msg = (WindowsMessages)wndEventArgs.Msg; var bytes = BitConverter.GetBytes(wndEventArgs.WParam); SideButton = bytes.Length > 2 ? bytes[2] == 1 ? Keys.XButton1 : bytes[2] == 2 ? Keys.XButton2 : Keys.None : Keys.None; }
private void HandleSaveClick(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONUP) { return; } if (Common.IsInside( cursorPos, new Point((int)this.MainFrame.Position.X, (int)(this.MainFrame.Position.Y + this.MainBitmap.Bitmap.Height - this.SaveBitmap.Bitmap.Height)), SaveBitmap.Bitmap.Width, SaveBitmap.Bitmap.Height)) { ResetMenuEntries(); SaveSequence(SequenceLevlerGUI.CurrentLevler.New); WriteLevelFile(); } }
/// <summary> /// Process windows messages /// </summary> protected override void WndProc(ref Message m) { MonitorEventArgs args = new MonitorEventArgs(Environment.UserName); WindowsMessages msg = (WindowsMessages)m.Msg; int wparam = m.WParam.ToInt32(); int lparam = m.LParam.ToInt32(); // check for session change notifications if (msg == WindowsMessages.WM_WTSSESSION_CHANGE) { log.Info("Get system message: Monitor session changed: wparam" + m.ToString()); if (wparam == (int)WTS.WTS_SESSION_LOCK) { manager.OnMonitorLocked(args); } else if (wparam == (int)WTS.WTS_SESSION_UNLOCK) { manager.OnMonitorUnlocked(args); } } else if (msg == WindowsMessages.WM_SYSCOMMAND) { if (wparam == (int)SysCommands.SC_MONITORPOWER) { log.Info("Get system message: Monitor Power. Lparam: " + m.ToString()); if (m.LParam.ToInt32() == Win32Helper.MONITOR_ON_PARAM) { manager.OnMonitorOpened(args); } else if (m.LParam.ToInt32() == Win32Helper.MONITOR_OFF_PARAM) { manager.OnMonitorShutdown(args); } } else if (wparam == (int)SysCommands.SC_SCREENSAVE) { log.Info("Get system message: Monitor PowerScreen Saver. " + m.ToString()); } } log.Debug("messages: " + m.ToString()); base.WndProc(ref m); return; }
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN || !SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinNameLoading").GetValue <bool>()) { return; } int active = GetActiveIndex(); if (ChampSkinGUI.ChampSkins[active] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[active].Pos, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Sprite.Height)) { return; } for (int i = active - 1; i >= 0; i--) { if (ChampSkinGUI.ChampSkins[i] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[i].Pos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue <StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } for (int i = active + 1; i < ChampSkinGUI.ChampSkins.Length; i++) { if (ChampSkinGUI.ChampSkins[i] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[i].Pos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue <StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } }
public void Process( ref MouseInput input, WindowsMessages windowsMessage, MSLLHOOKSTRUCT hookStruct) { if (input.Key != MouseKeys.WHEEL) { return; } if (ProcessorHelpers.HIWORD(hookStruct.mouseData) > 0) { input.State = MouseStates.KeyUp; } else { input.State = MouseStates.KeyDown; } }
public MouseInput Process( WindowsMessages msg, MSLLHOOKSTRUCT msllhookstruct) { var input = new MouseInput { X = msllhookstruct.pt.X, Y = msllhookstruct.pt.Y }; foreach (var processor in _processors) { processor.Process( ref input, msg, msllhookstruct); } return(input); }
/// <summary> /// Handler to run on keychange. /// </summary> /// <param name="nCode">Event code.</param> /// <param name="wParam">Type of windows message.</param> /// <param name="lParam">Keyboard status struct.</param> /// <returns>Pointer to next callback.</returns> private IntPtr LowLevelKeyboardHook(int nCode, WindowsMessages wParam, IntPtr lParam) { bool isKeyDown = wParam == WindowsMessages.KEYDOWN || wParam == WindowsMessages.SYSKEYDOWN; bool isKeyUp = wParam == WindowsMessages.KEYUP || wParam == WindowsMessages.SYSKEYUP; bool isAlt = false; KeyboardLowLevelHookStruct kbd = (KeyboardLowLevelHookStruct)Marshal.PtrToStructure(lParam, typeof(KeyboardLowLevelHookStruct)); if (kbd.flags.HasFlag(KeyboardLowLevelHookStructFlags.LLKHF_ALTDOWN)) { isAlt = true; } if (nCode >= 0 && FromAllowedWindow()) { if (isKeyDown) { LastMessageReceived = DateTime.Now; RaiseEvent(new KeyboardChangeEventArgs() { Direction = KeyChangeDirection.KeyDown, Key = (Keys)kbd.vkCode, Alt = isAlt, }); } else if (isKeyUp) { LastMessageReceived = DateTime.Now; RaiseEvent(new KeyboardChangeEventArgs() { Direction = KeyChangeDirection.KeyUp, Key = (Keys)kbd.vkCode, Alt = isAlt, }); } } return(WinApi.User32.Api.CallNextHookEx(IntPtr.Zero, nCode, (IntPtr)wParam, lParam)); }
private void HandleUiMove(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN && message != WindowsMessages.WM_MOUSEMOVE && message != WindowsMessages.WM_LBUTTONUP || (!_moveActive && message == WindowsMessages.WM_MOUSEMOVE) ) { return; } if (message == WindowsMessages.WM_LBUTTONDOWN) { _lastCursorPos = cursorPos; } if (message == WindowsMessages.WM_LBUTTONUP) { _lastCursorPos = new Vector2(); _moveActive = false; return; } var firstEnemyHero = new KeyValuePair<Obj_AI_Hero, ChampInfos>(); foreach (var enemy in _enemies.Reverse()) { firstEnemyHero = enemy; break; } if (firstEnemyHero.Key != null && Common.IsInside(cursorPos, firstEnemyHero.Value.SGui.SpellPassive.SizeSideBar, _hudSize.Width, _hudSize.Height)) { _moveActive = true; if (message == WindowsMessages.WM_MOUSEMOVE) { var curSliderX = Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerEnemyTracker") .GetMenuItem("SAwarenessUITrackerEnemyTrackerXPos") .GetValue<Slider>(); var curSliderY = Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerEnemyTracker") .GetMenuItem("SAwarenessUITrackerEnemyTrackerYPos") .GetValue<Slider>(); Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerEnemyTracker") .GetMenuItem("SAwarenessUITrackerEnemyTrackerXPos") .SetValue(new Slider((int) (curSliderX.Value + cursorPos.X - _lastCursorPos.X), curSliderX.MinValue, curSliderX.MaxValue)); Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerEnemyTracker") .GetMenuItem("SAwarenessUITrackerEnemyTrackerYPos") .SetValue(new Slider((int) (curSliderY.Value + cursorPos.Y - _lastCursorPos.Y), curSliderY.MinValue, curSliderY.MaxValue)); _lastCursorPos = cursorPos; } } var firstAllyHero = new KeyValuePair<Obj_AI_Hero, ChampInfos>(); foreach (var ally in _allies.Reverse()) { firstAllyHero = ally; break; } if (firstAllyHero.Key != null && Common.IsInside(cursorPos, firstAllyHero.Value.SGui.SpellPassive.SizeSideBar, _hudSize.Width, _hudSize.Height)) { _moveActive = true; if (message == WindowsMessages.WM_MOUSEMOVE) { var curSliderX = Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerAllyTracker") .GetMenuItem("SAwarenessUITrackerAllyTrackerXPos") .GetValue<Slider>(); var curSliderY = Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerAllyTracker") .GetMenuItem("SAwarenessUITrackerAllyTrackerYPos") .GetValue<Slider>(); Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerAllyTracker") .GetMenuItem("SAwarenessUITrackerAllyTrackerXPos") .SetValue(new Slider((int) (curSliderX.Value + cursorPos.X - _lastCursorPos.X), curSliderX.MinValue, curSliderX.MaxValue)); Menu.UiTracker.GetMenuSettings("SAwarenessUITrackerAllyTracker") .GetMenuItem("SAwarenessUITrackerAllyTrackerYPos") .SetValue(new Slider((int) (curSliderY.Value + cursorPos.Y - _lastCursorPos.Y), curSliderY.MinValue, curSliderY.MaxValue)); _lastCursorPos = cursorPos; } } }
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN || !SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinNameLoading").GetValue<bool>()) { return; } int active = GetActiveIndex(); if (ChampSkinGUI.ChampSkins[active] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[active].Pos, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Sprite.Height)) { return; } for (int i = active - 1; i >= 0; i--) { if (ChampSkinGUI.ChampSkins[i] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[i].Pos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue<StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } for (int i = active + 1; i < ChampSkinGUI.ChampSkins.Length; i++) { if (ChampSkinGUI.ChampSkins[i] != null && Common.IsInside(cursorPos, ChampSkinGUI.ChampSkins[i].Pos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Sprite.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue<StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } }
private void HandleSaveClick(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONUP || !SequenceLevlerGUI.Save.Sprite.Visible) { return; } if (Common.IsInside(cursorPos, SequenceLevlerGUI.Save.Sprite.Position, SequenceLevlerGUI.Save.Bitmap.Width, SequenceLevlerGUI.Save.Bitmap.Height)) { ResetMenuEntries(); SaveSequence(SequenceLevlerGUI.CurrentLevler.New); } }
private void HandleMainFrameClick(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONUP || !SequenceLevlerGUI.MainFrame.Sprite.Visible) { return; } if (Common.IsInside(cursorPos, SequenceLevlerGUI.MainFrame.Sprite.Position, SequenceLevlerGUI.MainFrame.Bitmap.Width, SequenceLevlerGUI.MainFrame.Bitmap.Height)) { for (int i = 0; i < 4; i++) { var row = SequenceLevlerGUI.SkillBlock[i]; for (int j = 0; j < 18; j++) { var column = row[j]; if (Common.IsInside(cursorPos, SequenceLevlerGUI.MainFrame.Sprite.Position + column, SequenceLevlerGUI.SkillBlockSize.Width, SequenceLevlerGUI.SkillBlockSize.Height)) { SequenceLevlerGUI.CurrentLevler.Sequence[j] = GetSpellSlot(i); } } } } }
void HandleUIMove(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN && message != WindowsMessages.WM_MOUSEMOVE && message != WindowsMessages.WM_LBUTTONUP || (!moveActive && message == WindowsMessages.WM_MOUSEMOVE) ) { return; } if (message == WindowsMessages.WM_LBUTTONDOWN) { lastCursorPos = cursorPos; } if (message == WindowsMessages.WM_LBUTTONUP) { lastCursorPos = new Vector2(); moveActive = false; return; } KeyValuePair<Obj_AI_Hero, ChampInfos> firstHero = new KeyValuePair<Obj_AI_Hero, ChampInfos>(); foreach (KeyValuePair<Obj_AI_Hero, ChampInfos> enemy in Enemies.Reverse()) { firstHero = enemy; break; } if (!Common.IsInside(cursorPos, firstHero.Value.SGui.SpellPassive.SizeSideBar, hudSize.Width, hudSize.Height)) { return; } moveActive = true; if (message == WindowsMessages.WM_MOUSEMOVE) { Slider curSliderX = Menu.UiTracker.GetMenuItem("SAwarenessUITrackerXPos").GetValue<Slider>(); Slider curSliderY = Menu.UiTracker.GetMenuItem("SAwarenessUITrackerYPos").GetValue<Slider>(); Menu.UiTracker.GetMenuItem("SAwarenessUITrackerXPos") .SetValue(new Slider((int)(curSliderX.Value + cursorPos.X - lastCursorPos.X), curSliderX.MinValue, curSliderX.MaxValue)); Menu.UiTracker.GetMenuItem("SAwarenessUITrackerYPos") .SetValue(new Slider((int)(curSliderY.Value + cursorPos.Y - lastCursorPos.Y), curSliderY.MinValue, curSliderY.MaxValue)); lastCursorPos = cursorPos; } }
private IntPtr WindowProcess(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam) { switch (msg) { case WindowsMessages.DESTROY: case WindowsMessages.QUIT: case WindowsMessages.CLOSE: Win.PostQuitMessage(0); isOpen = false; break; } return Win.DefWindowProc(hWnd, msg, wParam, lParam); }
public static extern bool PostMessageA(IntPtr hwnd, WindowsMessages Msg, int wParam, int lParam);
/// <summary> /// Places (posts) a message in the message queue associated with the thread that created the specified window and /// returns without waiting for the thread to process the message. /// </summary> /// <param name="windowHandle"> /// A handle to the window whose window procedure is to receive the message. The following /// values have special meanings. /// </param> /// <param name="message">The message to be posted.</param> /// <param name="wParam">Additional message-specific information.</param> /// <param name="lParam">Additional message-specific information.</param> public static void PostMessage(IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, UIntPtr lParam) { PostMessage(windowHandle, (uint) message, wParam, lParam); }
static extern IntPtr SendMessage( IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam );
/// <summary> /// Called when the game receives a window message. /// </summary> /// <param name="message"> /// The message. /// </param> /// <param name="cursorPos"> /// The cursor position. /// </param> /// <param name="key"> /// The key. /// </param> internal void OnReceiveMessage(WindowsMessages message, Vector2 cursorPos, uint key, WndEventComposition args) { //Spread the message to the menu's children recursively foreach (var child in this.Children.ToArray()) { child.OnReceiveMessage(message, cursorPos, key, args); } foreach (var item in this.Items.ToArray()) { item.OnReceiveMessage(message, cursorPos, key, args); } //Handle the left clicks on the menus to hide or show the submenus. if (message != WindowsMessages.WM_LBUTTONDOWN) { return; } if (this.IsRootMenu && this.Visible) { if (cursorPos.X - MenuSettings.BasePosition.X < MenuSettings.MenuItemWidth) { var n = (int)(cursorPos.Y - MenuSettings.BasePosition.Y) / MenuSettings.MenuItemHeight; if (this.MenuCount != n) { foreach (var schild in this.Children.ToArray()) { schild.Visible = false; } foreach (var sitem in this.Items.ToArray()) { sitem.Visible = false; } } } } if (!this.Visible) { return; } if (!this.IsInside(cursorPos)) { return; } if (!this.IsRootMenu && this.Parent != null) { //Close all the submenus in the level foreach (var child in this.Parent.Children.ToArray().Where(child => child.Name != this.Name)) { foreach (var schild in child.Children.ToArray()) { schild.Visible = false; } foreach (var sitem in child.Items.ToArray()) { sitem.Visible = false; } } } //Hide or Show the submenus. foreach (var child in this.Children.ToArray()) { child.Visible = !child.Visible; } //Hide or Show the items. foreach (var item in this.Items.ToArray()) { item.Visible = !item.Visible; } }
[DllImport("user32", EntryPoint="SendMessage", CharSet=CharSet.Auto, ExactSpelling=false, CallingConvention = CallingConvention.Winapi)] //Auto public static extern int SendMessageA( IntPtr hWnd, WindowsMessages Msg, int wParam, IntPtr lParam);
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { HandleUiMove(message, cursorPos, key); HandleChampClick(message, cursorPos, key); }
private void HandleChampClick(WindowsMessages message, Vector2 cursorPos, uint key) { if ((message != WindowsMessages.WM_KEYDOWN && key == 16) && message != WindowsMessages.WM_LBUTTONDOWN && (message != WindowsMessages.WM_KEYUP && key == 16) || (!_shiftActive && message == WindowsMessages.WM_LBUTTONDOWN)) { return; } if (message == WindowsMessages.WM_KEYDOWN && key == 16) { _shiftActive = true; } if (message == WindowsMessages.WM_KEYUP && key == 16) { _shiftActive = false; } if (message == WindowsMessages.WM_LBUTTONDOWN) { foreach (var enemy in _enemies.Reverse()) { if (Common.IsInside(cursorPos, enemy.Value.SGui.Champ.SizeSideBar, _champSize.Width, _champSize.Height)) { //TODO: Add Camera move if (Menu.UiTracker.GetMenuItem("SAwarenessUITrackerPingActive").GetValue<bool>()) { Packet.S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(enemy.Key.ServerPosition.X, enemy.Key.ServerPosition.Y, 0, 0, Packet.PingType.Normal)).Process(); } } } } }
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { if (message != WindowsMessages.WM_LBUTTONDOWN || !SkinChangerMisc.GetMenuItem("SAssembliesMiscsSkinChangerSkinNameLoading").GetValue<bool>()) { return; } int active = GetActiveIndex(); System.Drawing.Point mainPos = new System.Drawing.Point((int)MainFrame.Position.X, (int)MainFrame.Position.Y); System.Drawing.Point chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[active].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[active].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[active].SpriteInfoSmall.Bitmap.Height)) { return; } for (int i = active - 1; i >= 0; i--) { chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[i].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[i].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue<StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } for (int i = active + 1; i < ChampSkinGUI.ChampSkins.Length; i++) { chamPos = new System.Drawing.Point( mainPos.X + ChampSkinGUI.ChampSkins[i].Pos.X, mainPos.Y + ChampSkinGUI.ChampSkins[i].Pos.Y); if (Common.IsInside(cursorPos, chamPos, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Width, ChampSkinGUI.ChampSkins[i].SpriteInfoSmall.Bitmap.Height)) { StringList list = SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName) .GetValue<StringList>(); list.SelectedIndex = i; SkinChangerMisc.GetMenuItem( "SAssembliesMiscsSkinChangerSkinName" + ObjectManager.Player.ChampionName).SetValue(list); return; } } }
/// <summary> /// Sends the specified message to a window or windows. /// The SendMessage function calls the window procedure for the specified window and does not return until the window /// procedure has processed the message. /// </summary> /// <param name="windowHandle">A handle to the window whose window procedure will receive the message.</param> /// <param name="message">The message to be sent.</param> /// <param name="wParam">Additional message-specific information.</param> /// <param name="lParam">Additional message-specific information.</param> /// <returns>The return value specifies the result of the message processing; it depends on the message sent.</returns> public static IntPtr SendMessage(IntPtr windowHandle, WindowsMessages message, UIntPtr wParam, IntPtr lParam) { return SendMessage(windowHandle, (uint) message, wParam, lParam); }
public static extern IntPtr DefWindowProc(IntPtr hWnd, WindowsMessages Msg, IntPtr wParam, IntPtr lParam);
/// <summary>Constructor</summary> /// <param name="message">Message to redirect</param> /// <param name="hWndTo">Window handle to redirect to</param> public RedirectMessageFilter(WindowsMessages message, IntPtr hWndTo) { _message = message; _hWndTo = hWndTo; }
public static extern IntPtr PostMessage(IntPtr hWnd, WindowsMessages msg, IntPtr wParam, IntPtr lParam);
public static extern bool PostMessage(IntPtr hWnd, WindowsMessages.WM wMsg, IntPtr wParam, IntPtr lParam);
private void HandleInput(WindowsMessages message, Vector2 cursorPos, uint key) { HandleMainFrameClick(message, cursorPos, key); HandleSaveClick(message, cursorPos, key); HandleCancelClick(message, cursorPos, key); }
public static extern int SendMessage(IntPtr hWnd, WindowsMessages.WM wMsg, IntPtr wParam, IntPtr lParam);
void HandleChampClick(WindowsMessages message, Vector2 cursorPos, uint key) { if ((message != WindowsMessages.WM_KEYDOWN && key == 16) && message != WindowsMessages.WM_LBUTTONDOWN && (message != WindowsMessages.WM_KEYUP && key == 16) || (!shiftActive && message == WindowsMessages.WM_LBUTTONDOWN)) { return; } if (message == WindowsMessages.WM_KEYDOWN && key == 16) { shiftActive = true; } if (message == WindowsMessages.WM_KEYUP && key == 16) { shiftActive = false; } if (message == WindowsMessages.WM_LBUTTONDOWN) { foreach (KeyValuePair<Obj_AI_Hero, ChampInfos> enemy in Enemies.Reverse()) { if (Common.IsInside(cursorPos, enemy.Value.SGui.Champ.SizeSideBar, _champSize.Width, _champSize.Height)) { //TODO: Add Camera move } } } }