嚴(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)不是灰色的了,添加了一個事件處理程序,放了一個MessageBox進(jìn)去,可以響應(yīng)了。
我的編譯環(huán)境是:VS2005+SP1。
posted on 2008-06-02 23:21 楊粼波 閱讀(3880) 評論(5) 編輯 收藏 引用
剛放進(jìn)去的按鈕是灰色的,但是當(dāng)你為他添加了響應(yīng)函數(shù)后,他就可以用了,不必重載OnUpdateCmdUI吧 回復(fù) 更多評論
哦,我知道了,如果按鈕的消息處理是在CMainFrame中的就不用OnUpdateCmdUI,在其他類的話還是要重載OnUpdateCmdUI的。3Q呵呵 回復(fù) 更多評論
具體我沒有去深究個緣由,等有時間會去看看究竟內(nèi)部的。 俺就曉得OnUpdateCmdUI是處理的WM_UI_UPDATE()這個消息的。 等我搞清楚了,就在后面把原理加上去。 回復(fù) 更多評論
另外請教一個問題,在VC中的CDialogBar中加入一個VB控件,該控件含有OnClick()事件,當(dāng)點擊該控件時,在CMainFrame中如何實現(xiàn)OnClick()事件響應(yīng)。如果是VC自己的一個按鈕,雙擊它,然后就可以添加事件代碼,框架便會響應(yīng)該事件。 回復(fù) 更多評論
剛剛遇上了這個問題,下面是找到的答案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ù) 更多評論
Powered by: C++博客 Copyright © 楊粼波