C#打开一个应用程序(第三方exe文件),然后在打开的这个应用程序界面上自动的按一下某button,
目前这个button,用键盘回车也是能激活的!类似外挂程序,控制第三方软件的button!如何实现吗?大家帮帮忙!

解决方案 »

  1.   

     const uint BM_CLICK = 0xF5; //鼠标点击的消息,对于各种消息的数值,大家还是得去API手册
     IntPtr hwndCalc = FindWindow(null, "第三方软件"); //查找计算器的句柄
     if (hwndCalc != IntPtr.Zero)
    {
        //如何模拟回车?
    }2.那个按键是图片
    用下面这个方法不知道怎么button的名字
    IntPtr hwndThree = FindWindowEx(hwndCalc, 0, null, "按键名称不知道");
      

  2.   

    sendmessage()能不能具体一点?
      

  3.   

    [DllImport("user32.dll", EntryPoint="SendMessageA")]
    private static extern int SendMessage (IntPtr hwnd, int wMsg, IntPtr wParam,  string lParam);这是Windows API,消息机制
    楼主去找找这方面的书看看即可。
      

  4.   


    SendMessage(hwndCalc, 0X104, 0Xd, 0);//enter
    SendMessage(hwndCalc, 0X105, 0Xd, 0);//释放enter
    没效果啊
      

  5.   

           System.Windows.Forms.SendKeys.Send( "{Enter}");
    直接这个倒是可以