嚴(yán)以律己,寬以待人. 三思而后行. GMail/GTalk: yanglinbo#google.com; MSN/Email: tx7do#yahoo.com.cn; QQ: 3 0 3 3 9 6 9 2 0 .
如上圖所示,已經(jīng)不是灰色的了,添加了一個(gè)事件處理程序,放了一個(gè)MessageBox進(jìn)去,可以響應(yīng)了。
我的編譯環(huán)境是:VS2005+SP1。
posted on 2008-06-02 23:21 楊粼波 閱讀(3881) 評(píng)論(5) 編輯 收藏 引用
剛放進(jìn)去的按鈕是灰色的,但是當(dāng)你為他添加了響應(yīng)函數(shù)后,他就可以用了,不必重載OnUpdateCmdUI吧 回復(fù) 更多評(píng)論
哦,我知道了,如果按鈕的消息處理是在CMainFrame中的就不用OnUpdateCmdUI,在其他類(lèi)的話還是要重載OnUpdateCmdUI的。3Q呵呵 回復(fù) 更多評(píng)論
具體我沒(méi)有去深究個(gè)緣由,等有時(shí)間會(huì)去看看究竟內(nèi)部的。 俺就曉得OnUpdateCmdUI是處理的WM_UI_UPDATE()這個(gè)消息的。 等我搞清楚了,就在后面把原理加上去。 回復(fù) 更多評(píng)論
另外請(qǐng)教一個(gè)問(wèn)題,在VC中的CDialogBar中加入一個(gè)VB控件,該控件含有OnClick()事件,當(dāng)點(diǎn)擊該控件時(shí),在CMainFrame中如何實(shí)現(xiàn)OnClick()事件響應(yīng)。如果是VC自己的一個(gè)按鈕,雙擊它,然后就可以添加事件代碼,框架便會(huì)響應(yīng)該事件。 回復(fù) 更多評(píng)論
剛剛遇上了這個(gè)問(wèn)題,下面是找到的答案A button in a CDialogBar object is disabled automatically if the command routing does not contain a command handler function for the button.To enable a button in a CDialogBar object, the command routing must include a command handler for the button. NOTE: Because the CDialogBar object is not included in the routing scheme, the ON_BN_CLICKED() or ON_COMMAND() handler must be placed in one of the objects mentioned above that is in the routing scheme and not in the CDialogBar class.from:http://support.microsoft.com/default.aspx?scid=kb;en-us;98198 回復(fù) 更多評(píng)論
Powered by: C++博客 Copyright © 楊粼波