예제 #1
0
 public static bool KillFocus(){
     var helperAutomation = new HelperAutomation();
     var focusControlHandle = helperAutomation.GetFocusControlHandle();
     Win32Declares.Message.SendMessage(focusControlHandle,
         Win32Constants.Focus.WM_KILLFOCUS, IntPtr.Zero, IntPtr.Zero);
     return helperAutomation.GetFocusControlHandle()!=focusControlHandle;
 }
예제 #2
0
        public static void SetText(string text)
        {
            var    automation         = new HelperAutomation();
            IntPtr focusControlHandle = automation.GetFocusControlHandle();

            SetText(focusControlHandle, text);
        }
예제 #3
0
 /// <summary>
 /// paste clipbard data
 /// </summary>
 /// <param name="mainWindowHandle">the widbow that contains the control in which the data is going to be pasted</param>
 public static void PasteFromClipBoard(IntPtr mainWindowHandle) {
     WindowAutomation.FocusWindow(mainWindowHandle);
     var helperAutomation = new HelperAutomation();
     IntPtr focusControlHandle = helperAutomation.GetFocusControlHandle();
     Win32Declares.Message.SendMessage(focusControlHandle, Win32Constants.Clipboard.WM_PASTE, IntPtr.Zero,
                                       IntPtr.Zero);
 }
예제 #4
0
        /// <summary>
        /// paste clipbard data
        /// </summary>
        /// <param name="mainWindowHandle">the widbow that contains the control in which the data is going to be pasted</param>
        public static void PasteFromClipBoard(IntPtr mainWindowHandle)
        {
            WindowAutomation.ForceWindowToForeground(mainWindowHandle);
            var    helperAutomation   = new HelperAutomation();
            IntPtr focusControlHandle = helperAutomation.GetFocusControlHandle();

            Win32Declares.Message.SendMessage(focusControlHandle, Win32Constants.Clipboard.WM_PASTE, IntPtr.Zero,
                                              IntPtr.Zero);
        }
        private void ExecuteAdditionalCommands(ICommandAdapter adapter) {
            _additionalCommands = this.ParameterValue("AdditionalCommands", true);
            if (!_additionalCommands)
                return;
            if (this.ParameterValue("ToggleNavigation", true)) {
                ToggleNavigation(adapter);
            }

            var activeWindowSize = this.ParameterValue("ActiveWindowSize", _defaultWindowSize);
            var activeWindowSizeCommand = new ResizeWindowCommand();
            activeWindowSizeCommand.Parameters.MainParameter = new MainParameter(String.Format("{0}x{1}", activeWindowSize.Width, activeWindowSize.Height));
            activeWindowSizeCommand.Execute(adapter);

            if (this.ParameterValue(HideCursorCommand.Name, true)) {
                var hideCaretCommand = new HideCursorCommand();
                hideCaretCommand.Execute(adapter);
            }

            if (this.ParameterValue(KillFocusCommand.Name, true)) {
                var helperAutomation = new HelperAutomation();
                Win32Declares.Message.SendMessage(helperAutomation.GetFocusControlHandle(), Win32Declares.Message.EM_SETSEL, -1, 0);
                var hideCaretCommand = new KillFocusCommand();
                hideCaretCommand.Execute(adapter);
            }

            var sendKeys = this.ParameterValue<string>("SendKeys");
            if (!string.IsNullOrEmpty(sendKeys)) {
                var sendKeysCommand = new SendKeysCommand();
                sendKeysCommand.Parameters.MainParameter = new MainParameter(sendKeys);
                sendKeysCommand.Execute(adapter);
            }

            Wait(adapter, 1000);
        }
예제 #6
0
 public static void SetReadOnly(){
     var helperAutomation = new HelperAutomation();
     SetReadOnly(helperAutomation.GetFocusControlHandle());
 }
예제 #7
0
 /// <summary>
 /// finds the focused control and sets its text
 /// </summary>
 /// <param name="text"></param>
 public static void SetText(string text) {
     var automation = new HelperAutomation();
     IntPtr focusControlHandle = automation.GetFocusControlHandle();
     SetText(focusControlHandle, text);
 }