程序运行起来后,在某些情况下点击左方向键就会出现这个错误,麻烦各位老哥帮忙看看,谢谢
void CMainFrame::Backward()
{
COptionUI* p_OptionBtn =NULL;
if( 0 == pControl->GetCurSel())
{
}
else if(1 == pControl->GetCurSel())
{
if(m_NumGroupMainMenu <= 0)
{
m_NumGroupMainMenu = m_pGroupMainMenu->GetSize();
}
p_OptionBtn = static_cast(m_pGroupMainMenu->GetAt(--m_NumGroupMainMenu));
if(!p_OptionBtn->IsSelected())
{
p_OptionBtn->Selected(true);
}
}
//这次报错是这个语句里报错,但是其他的也有问题
else if(4 == pControl->GetCurSel()) //5改为4 1589
{
if(m_NumGroupDispatch <= 0)
{
m_NumGroupDispatch = m_pGroupDispatch->GetSize();
}
p_OptionBtn = static_cast<COptionUI*>(m_pGroupDispatch->GetAt(--m_NumGroupDispatch));
if(!p_OptionBtn->IsSelected())
{
p_OptionBtn->Selected(true);
}
}
else if(7 == pControl->GetCurSel())//1594
{
if(m_NumGroupSysSet <= 0)
{
m_NumGroupSysSet = m_pGroupSysSet->GetSize();
}
p_OptionBtn = static_cast<COptionUI*>(m_pGroupSysSet->GetAt(--m_NumGroupSysSet));
if(!p_OptionBtn->IsSelected())
{
p_OptionBtn->Selected(true);
}
}
}
![图片说明](https://img-ask.csdn.net/upload/201808/06/1533540518_545209.png)
void CMainFrame::FNumBtnFun(TNotifyUI& msg)//1128
{
CString name = msg.pSender->GetName();
COptionUI* pOption = NULL;
if(0 == pControl->GetCurSel()) {
// if(name == _T("F9Btn")) pControl->SelectItem(7);
// if(name == _T("F0Btn")) pControl->SelectItem(34);
}
else if(12 == pControl->GetCurSel())
{
if(pOption = static_cast<COptionUI*>(m_pBusinRegistGroup->GetAt(_ttoi(msg.pSender->GetUserData()) - 1)))
pOption->Activate();
}
else if(13 == pControl->GetCurSel())
{
if(pOption = static_cast<COptionUI*>(m_pBusinRequestGroup->GetAt(_ttoi(msg.pSender->GetUserData()) - 1)))
pOption->Activate();
}
}
这个函数中也会错类似的错误,不知道是不是Activate用错了的原因