void CBtnDlg::OnOK()
{
 // TODO: Add extra validation here
 // 动态构建按钮代码
 CButton* pNewButton = new CButton();// 也可以定义为类的成员变量。
 CRect rcButton( 10, 10, 50, 30); // 按钮在对话框中的位置。
 pNewButton->Create("按钮", 0, rcButton, this, 10098);
 pNewButton->ShowWindow(SW_SHOW);
   
 //CDialog::OnOK();
}

LRESULT CBtnDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
 // TODO: Add your specialized code here and/or call the base class
 if ( WM_COMMAND== message )
 {
  WORD wID = LOWORD(wParam);
  if ( 10098 == wID)
  {
   CDC* pDC = GetDC();
   pDC->TextOut( 100, 100, "文字");
   ReleaseDC(pDC);
  }
    }
 return CDialog::DefWindowProc(message, wParam, lParam);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
相关资源
相似解决方案