试着做QQ游戏外挂,我要如何获得该游戏窗口下“开始”按钮等一些按钮的句柄呢?
IntPtr 窗体句柄=FindWindows(null,QQ游戏句柄);
IntPtr 控件句柄= FindWindowEX(QQ游戏句柄(“开始”按钮句柄??),一些参数如何写是不是BUTTON,null);
SendMessage(“开始”按钮句柄, 0x201,0,0);//鼠标左击按下
SendMessage(“开始”按钮句柄, 0x202,0,0);//鼠标左击放开以上是我的思路!问题是不知道 游戏窗口下的控件句柄,望高人指点或者建议一些可参考资料!若能写出实例供参考那就太好了!! 我用了一些句柄查看器也找不出。

解决方案 »

  1.   

    查找子窗口的方法:
    public delegate bool CallBack(int hwnd, int lParam);#region API[DllImport("kernel32.dll")]
    public static extern int GetCurrentThreadId();[DllImport("user32.dll")]
    public static extern int GetThreadDesktop(int dwThread);[DllImport("user32.dll")]
    public static extern int GetParent(IntPtr hwnd);[DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern int EnumDesktopWindows(int hDeskTop, CallBack x, int lParam);#endregion#region 全局变量IntPtr pHWnd;//QQ游戏句柄
    IntPtr[] cHWnd = new IntPtr[50];//保存控件句柄
    int num = 0;//找到的控件数量#endregionprivate void findControlObj()
    {
        num = 0;
        int threadID = GetCurrentThreadId();
        int hDesk = GetThreadDesktop(threadID);
        int result = EnumDesktopWindows(hDesk, new CallBack(mycallbak), 0);
        MessageBox.Show("找到"+this.num+"个子窗口!");
    }private bool mycallbak(int h, int lParam)
    {
        IntPtr hWnd = (IntPtr)h;
        if (new IntPtr(GetParent(hWnd)) == this.pHWnd)
        {
            cHWnd[this.num]=hWnd;
            this.num++;
        }
        return true;
    }