新键一对话框资源IDD_XXXX,在上面放一些按钮,编辑框什么的,并为其生成一个类CPanel,继承自CDialog,现在在一个类的.h文件中申明:
CPanel panel;
在适合的时候:
panel.Create(IDD_XXXX,this);然后我想在一定的时候知道IDD_XXXX上是什么类型的控件获得了焦点,于是用:
CWnd* child=panel.GetFoucs();
......在这里我想知道child是什么类型的,请问怎么办?
用IsKindOf好像不行,msdn中有解释。

解决方案 »

  1.   

    把你获得焦点的句柄传给int GetDlgCtrlID(HWND hwndCtl);
    返回该控件的ID,然后与你的控件ID进行比较。
      

  2.   

    pWnd ->GetRuntimeClass() ->m_lpszClassName ; //类名
      

  3.   

    use GetClassName to get the class name of the controls !
    int GetClassName(
      HWND hWnd,           // handle to window
      LPTSTR lpClassName,  // class name
      int nMaxCount        // size of class name buffer
    );
      

  4.   

    就用GetClassName吧。可以得到想要的控件类型的名字
    int GetClassName(
      HWND hWnd,           // handle to window
      LPTSTR lpClassName,  // class name
      int nMaxCount        // size of class name buffer
    );