如题。
可得到QQ主窗体的对像, 例如,高多少,宽多少。
打开子窗体时,是否也能得到子窗体的对像?
高手快点出现吧。
谢谢!

解决方案 »

  1.   

    用这个APIGetWindowRect
    别问我具体代码.哈哈....
      

  2.   

    思路
    作一个进程监视的程序
    当发现QQ启动后,用楼上所说的API去获得
      

  3.   

    可以由QQ的主程序名,得到QQ的进程Process,然后由Process.MainWindowHandle 属性得到QQ主窗口的句柄,然后使用APIGetClientRect得到所在的矩形:[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
    public static extern bool GetClientRect(IntPtr hWnd, [In, Out] ref RECT rect);[StructLayout(LayoutKind.Sequential)]
    public struct RECT
    {
        public int left;
        public int top;
        public int right;
        public int bottom;
        public RECT()
        {
        }
        public RECT(int left, int top, int right, int bottom)
        {
            this.left = left;
            this.top = top;    
            this.right = right;
            this.bottom = bottom;
        }
    }
      

  4.   

    老大,我要的是屏幕中的位置呀,GetClientRect得到的是以他自己为中心的位置呀。
    GetClientRect 结果, left = 0; right = 100;  top = 0 ; bottom = 100;
    刚好该窗体的高度是100, 宽度也是100呀。
    例如他在屏幕中的最左边最顶点的位置是(20, 20)
    要的结果是 left = 20; right = 120; top = 20 ; bottom = 120
    ~~~~~~
      

  5.   

    用GetWindowRect 取得QQ窗口的位置, 最后:
    QQ的高度+QQ的顶端=QQ的底部.
    QQ的宽度+QQ的左端=QQ的右端.