Ejemplo n.º 1
0
        //根据进程ID绑定窗口
        public bool BindWindow(int hwd)
        {
            if (0 == hwd)
            {
                return(false);
            }
            int result = DMObeject.BindWindow(hwd, "normal", "windows", "windows", 0);

            if (0 == result)
            {
                return(false);
            }
            WindowHandle = hwd;
            SetHW();
            return(true);
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();
            AutoRegCom("regsvr32 -s dm.dll");
            //2.安装Hook,在程序入口中写上下面的代码(本例中用了WinForm,在Form的构造方法中安装Hook即可)
            //安装键盘钩子

            k_hook.KeyDownEvent += new KeyEventHandler(hook_KeyDown);//钩住键按下
            hwnd = dm.GetMousePointWindow();
            dm.BindWindow(hwnd, "dx", "一笑倾城 - 扛不住怪我咯", "", 0);
            k_hook.Start();//安装键盘钩子
        }
Ejemplo n.º 3
0
        public Form1()
        {
            InitializeComponent();

            AutoRegCom("regsvr32 -s dm.dll");
            dm = new Dm.dmsoft();

            //var hwnd = dm.FindWindowEx(0, "", "PotPlayer");
            var hwnd = dm.FindWindowEx(0, "CHWindow", null);

            if (dm.BindWindow(hwnd, "dx2", "windows", "windows", 0) == 1)
            {
                this.Text = $"绑定成功:" + hwnd;
            }
            else
            {
                this.Text = $"绑定失败";
                return;
            }
        }