Exemple #1
0
            protected override void OnCreate(ref CreateWindowPacket packet)
            {
                this.m_textBox = StaticBox.Create(
                    "Ahoy!",
                    hParent: this.Handle);

                this.m_editBox = EditBox.Create(
                    "Nothing here yet.",
                    hParent: this.Handle,
                    controlStyles:
                    EditBox.EditStyles.ES_MULTILINE | EditBox.EditStyles.ES_WANTRETURN |
                    (EditBox.EditStyles)WindowStyles.WS_VSCROLL);

                this.m_layout.ClientArea = this.GetClientRect();
                this.m_layout.Margin     = new Rectangle(10, 10, 10, 10);
                this.m_layout.Children.Add(this.m_textBox);
                this.m_layout.Children.Add(this.m_editBox);
                this.m_layout.PerformLayout();
                this.m_timerProc = (wnd, uMsg, eventId, millis) =>
                {
                    try
                    {
                        this.m_timesExecuted++;
                        Input.InitKeyboardInput(out this.m_inputs[0], VirtualKey.H, false);
                        Input.InitKeyboardInput(out this.m_inputs[1], VirtualKey.H, true);
                        Input.InitKeyboardInput(out this.m_inputs[3], VirtualKey.E, false);
                        Input.InitKeyboardInput(out this.m_inputs[4], VirtualKey.E, true);
                        Input.InitKeyboardInput(out this.m_inputs[5], VirtualKey.L, false);
                        Input.InitKeyboardInput(out this.m_inputs[6], VirtualKey.L, true);
                        Input.InitKeyboardInput(out this.m_inputs[7], VirtualKey.L, false);
                        Input.InitKeyboardInput(out this.m_inputs[8], VirtualKey.L, true);
                        Input.InitKeyboardInput(out this.m_inputs[9], VirtualKey.O, false);
                        Input.InitKeyboardInput(out this.m_inputs[10], VirtualKey.O, true);
                        var x = User32Helpers.SendInput(this.m_inputs);
                    }
                    catch (Exception ex) {
                        this.m_editBox.SetText($"ERROR: {ex.Message}\r\n{ex.StackTrace}");
                    }
                };

                this.m_timerId = User32Methods.SetTimer(this.Handle, IntPtr.Zero, 20, this.m_timerProc);
                base.OnCreate(ref packet);
            }