如果知道一个控件类型的对话框句柄是编辑框控件

 TCHAR chs[256];
 ::GetClassName(pCtrl->m_hWnd, chs, 256);
 CString str(chs);

 if (_T("Edit")==str)
 {
  // CEdit* CString
  CString sValue;
  CEdit* pEdit = (CEdit*)pCtrl;。。。
 }
 else if (_T("Button")==str)

注意以下方法无效,只能获得 CWnd* 的 CRunTimeClass

CWnd*   pWnd   =   GetWindow(GW_CHILD);
int   n=pWnd-> IsKindOf(RUNTIME_CLASS(CEdit)
if(n)
MessageBox( "是Edit框 ");
else
MessageBox( "不是Edit框 ");

相关文章:

  • 2021-12-25
  • 2021-10-28
  • 2021-11-19
  • 2022-02-06
  • 2022-12-23
  • 2021-12-10
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
相关资源
相似解决方案