在vc++里面,debug模式运行出错,但在release模式下能正常运行,怎么办?
我只是想在子窗体中调用主窗体的菜单! 如下:
void CTrsWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUPMENU));
(CMainFrame*)m_pFrame =(CMainFrame*)AfxGetApp()->m_pMainWnd;
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
//CWnd* pWndPopupOwner = this;
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, m_pFrame);
} 有什么别的好办法吗?
谢谢!
我只是想在子窗体中调用主窗体的菜单! 如下:
void CTrsWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUPMENU));
(CMainFrame*)m_pFrame =(CMainFrame*)AfxGetApp()->m_pMainWnd;
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
//CWnd* pWndPopupOwner = this;
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, m_pFrame);
} 有什么别的好办法吗?
谢谢!
解决方案 »
- 如何通过c++进行socket通信时。客户端绑定本地ip以及地址
- 字符个数
- 怎么解决同一行加载多个工具栏后出现的工具栏间的空白问题?
- setwindowshookex不稳定的问题(高分)
- 一个很奇怪的问题,大家进来看看
- 请问一个WIN2000上注册服务的问题。
- 如何把一个int型数字转化成char *(ASCII)?可以使用什么汉书?
- 请教大家:你觉得读在职研究生,有意义吗?
- 如何注册音频压缩Filter (*.acm)? 谁能帮我注册回去阿,我出100分阿。
- 我的vc6.0为什么不能很好的支持msdn 4月版?
- 请问各位大虾,什么地方有关于编写发送手机短信的资料!。。。急!
- 只给我一堆数据,就叫我将其还原成位图图象,我该怎么办??望高高手能指明方向!!!
好象是,CMenu::Deattch();记不清了,查MSDN吧。
改成这样也一样只能在release下通过!
void CTrsWnd::OnContextMenu(CWnd* pWnd, CPoint point)
{
CMenu menu;
VERIFY(menu.LoadMenu(u_idPopupMenu));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
//CWnd* pWndPopupOwner = this;
::TrackPopupMenu(pPopup->m_hMenu,TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, 0, pWndPopupNemu->GetSafeHwnd(), NULL);
}
大侠帮帮忙!
{
CMenu menu;
VERIFY(menu.LoadMenu(IDR_POPUPMENU));
(CMainFrame*)m_pFrame =(CMainFrame*)AfxGetApp()->m_pMainWnd;
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
//CWnd* pWndPopupOwner = this;
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
} 把菜单的所属改为本窗体this!
但是这样的话,向要调用退出整个程序的onclose或者是about对话框,由或者是调用其他子窗体就变得非常困难了!而且追后还是得用(CMainFrame*)m_pFrame =(CMainFrame*)AfxGetApp()->m_pMainWnd; 这样的调用吧?
高手谢谢!
原来是另外一个函数惹的祸!
void CTransparentAniWnd::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// if(m_pFrame!=NULL)
// {
// if(m_pFrame->IsWindowVisible())
// {
// m_pFrame->SetForegroundWindow();
// SetFocus();
// }
// }
CWnd::OnRButtonDown(nFlags, point);
//CLittlePigDlg dlg;
//if(IDOK!=dlg.DoModal())
// DestroyWindow();
}
麻烦大家不好意思了!