0

I'm just trying to create a program that presses Numpad 0 in the program, every few set seconds. This is what I have so far.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        int enabled = 0;
        public Form1()
        {
            InitializeComponent();
        }

        private void Start_Click(object sender, EventArgs e)
        {
            if (enabled == 0)
            {
                Start.Text = "Stop";
                Timer.Enabled = true;
                enabled = 1;
            }
            else
            {
                Start.Text = "Start";
                Timer.Enabled = false;
                enabled = 0;
                label2.Text = "0";
            }

        }

        private void Timer_Tick(object sender, EventArgs e)
        {
            SendKeys.Send("{NumpadIns}");
            label2.Text = Convert.ToString(Convert.ToInt32(label2.Text) + 1);
        }
    }
}

I have tried this so far

{NumpadIns}
{NumIns}
{Num0}
{INS}

Nothing seems to work, the program I'm using with it is bound to Num Zero so it has to be Num Zero and not 0 on the top row, or Insert. Thanks (Yes I have googled but for some reason this is really hard to find).

4

1 回答 1

0

根据我的经验,您应该使用一些包装器,例如Input Simulator。它易于使用并且具有许多预定义的枚举,因此您不需要传递 String 参数。

于 2013-09-03T03:31:06.807 回答