首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

函数调用有关问题,多谢

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

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

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();
}

热点排行