我想把系统的m_hMenuShared换成m_hMenu
m_hMenu.ClearMemory();
m_hMenu.Attach(m_hMenuShared);
等我再关掉窗口,再建立一个子窗口崩溃了,
崩在:
void CMDIChildWnd::AssertValid() const
{
CFrameWnd::AssertValid();
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
}
为什么?
2 个解决方案
#1
Attach()就是m_hMenuShared句柄与m_hMenu相连接
用m_hMenu连接后就以m_hMenu来替代m_hMenuShared实例对象操作
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
换成:
ASSERT(m_hMenu== NULL || ::IsMenu(m_hMenu));//应当不崩吧,
这样试试:
m_hMenu.Detach();
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
用m_hMenu连接后就以m_hMenu来替代m_hMenuShared实例对象操作
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
换成:
ASSERT(m_hMenu== NULL || ::IsMenu(m_hMenu));//应当不崩吧,
这样试试:
m_hMenu.Detach();
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
#2
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
是系统的,改不了啊
#1
Attach()就是m_hMenuShared句柄与m_hMenu相连接
用m_hMenu连接后就以m_hMenu来替代m_hMenuShared实例对象操作
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
换成:
ASSERT(m_hMenu== NULL || ::IsMenu(m_hMenu));//应当不崩吧,
这样试试:
m_hMenu.Detach();
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
用m_hMenu连接后就以m_hMenu来替代m_hMenuShared实例对象操作
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
换成:
ASSERT(m_hMenu== NULL || ::IsMenu(m_hMenu));//应当不崩吧,
这样试试:
m_hMenu.Detach();
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
#2
ASSERT(m_hMenuShared == NULL || ::IsMenu(m_hMenuShared));
是系统的,改不了啊