我有以下代码: IMPLEMENT_DYNCREATE(CChildFrame,CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
....
//here I want make affect
....
END_MESSAGE_MAP()
我想打电话
CChildFrame::OnFrameResize
在窗口调整大小后运行,所以我尝试了这个:
ON_WM_SIZING(&CChildFrame::OnFrameResize)
和
ON_WM_SIZE(&CChildFrame::OnFrameResize)
但不起作用。我做错了什么?
答案 0 :(得分:2)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//here I want make affect
ON_WM_SIZE() // This will map the WM_SIZE message to CChildFrame::OnSize
END_MESSAGE_MAP()
// So put your resize code here:
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
}
答案 1 :(得分:0)
您尝试使用abc()
覆盖xyz()
这是不可能的,但ON_WM_SIZE
只能调用OnSize()
功能。要捕获resize事件,您必须覆盖OnSize()
函数并将ON_WM_SIZE
添加到消息映射。
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_WM_SIZE()
END_MESSAGE_MAP()
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
//Your stuff or function call OnFrameResize()
}