读书人

函数调用有关问题,多谢

发布时间: 2012-01-23 21:57:28 作者: rapoo

函数调用问题,谢谢
一个按钮事件里面我要调用一个自定义函数,来触发事件
这样对么 谢谢

void CListDlg::OnBtnShow() //按钮事件
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
CListDlg Show;
Show.fun1(); //fun1为自定义函数, 负责edit框中显示变量
UpdateData(FALSE);

}

[解决办法]
参考:

void CMy1Dlg::OnButton1()//按钮单击事件
{
// TODO: Add your control notification handler code here
fun();
}

void CMy1Dlg::fun1()
{
CWnd *pWnd;
pWnd=this-> GetDlgItem(IDC_EDIT1);
pWnd-> SetWindowText( "你好啊! ");
}
[解决办法]
不好意思,上面少了个1,如下:
void CMy1Dlg::OnButton1()//按钮单击事件
{
// TODO: Add your control notification handler code here
fun1();
}

读书人网 >VC/MFC

热点推荐