请问为什么我删除CAnimateCtrl时出错?
在对话框里显示一个AVI动画
.H文件中
CAnimateCtrl *m_pAnimateCtrl;
.CPP文件中
BOOL CCTestAnimateDlg::OnInitDialog()
{
...
m_pAnimateCtrl = new Cm_pAnimateCtrl;
m_pAnimateCtrl->Create(WS_CHILD|WS_VISIBLE|ACS_TRANSPARENT|ACS_CENTER,CRect(0, 0, 100, 100),this,99991);
m_pAnimateCtrl->Open("E:\\vc.avi");
m_pAnimateCtrl->Play(0,-1,-1);
// m_pAnimateCtrl->Stop();//如果一开始就Stop,删除就不会出错
m_pAnimateCtrl->ShowWindow(SW_SHOW);
}
void CCTestAnimateDlg::OnDelete()
{//运行这个函数就会报错
m_pAnimateCtrl->Stop();
delete m_pAnimateCtrl;
m_pAnimateCtrl = NULL;
}
错误信息
BOOL CWnd::OnCommand(WPARAM wParam, LPARAM lParam)
// return TRUE if command invocation was attempted
{
UINT nID = LOWORD(wParam);
HWND hWndCtrl = (HWND)lParam;
int nCode = HIWORD(wParam);
// default routing for command messages (through closure table)
if (hWndCtrl == NULL)
{
// zero IDs for normal commands are not allowed
if (nID == 0)
return FALSE;
// make sure command has not become disabled before routing
CTestCmdUI state;
state.m_nID = nID;
OnCmdMsg(nID, CN_UPDATE_COMMAND_UI, &state, NULL);
if (!state.m_bEnabled)
{
TRACE1("Warning: not executing disabled command %d\n", nID);
return TRUE;
}
// menu or accelerator
nCode = CN_COMMAND;
}
else
{
// control notification
出错在这一行 ASSERT(nID == 0 || ::IsWindow(hWndCtrl));
if (_afxThreadState->m_hLockoutNotifyWindow == m_hWnd)
return TRUE; // locked out - ignore control notification
// reflect notification to child window control
if (ReflectLastMsg(hWndCtrl))
return TRUE; // eaten by child
// zero IDs for normal commands are not allowed
if (nID == 0)
return FALSE;
}
#ifdef _DEBUG
if (nCode < 0 && nCode != (int)0x8000)
TRACE1("Implementation Warning: control notification = $%X.\n",
nCode);
#endif
return OnCmdMsg(nID, nCode, NULL, NULL);
}