可以跟踪到 mfc提供的源代码内部,(注:如果打开了mfc源代码,设置了断点,但是跟不进去,那就需要更新PDB文件,具体网上搜)
打开 wincore.cpp文件(D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\src\mfc)。查看 312 行,所在函数如下:
CWnd* PASCAL CWnd::FromHandle(HWND hWnd)
{
CHandleMap* pMap = afxMapHWND(TRUE); //create map if not exist
ASSERT(pMap != NULL);
CWnd* pWnd = (CWnd*)pMap->FromHandle(hWnd); #ifndef _AFX_NO_OCC_SUPPORT
pWnd->AttachControlSite(pMap);
#endif ASSERT(pWnd == NULL || pWnd->m_hWnd == hWnd);
return pWnd;
} 断言就是 Assert( pWnd == NULL || pWnd->m_hwnd == hWnd );也就是读取句柄映射表错误,有2种可能:
1你传入的窗口句柄为空,也就是生成了窗口对象但是没有使用 Create创建窗口。
2.窗口所在线程不是当前所在线程,那么使用FromHandle读取映射窗口指针或者映射临时窗口指针必然会出错。窗口都是线程相关的噢
你点击菜单命令出错,你就有可能你的菜单命令执行的代码有 FromHandle语句,你看看,一定就是它 200分啊,还有不明白的问我吧,一定要把分给我

sampleviewer add menu item error 'assert'的更多相关文章

  1. [转]NopCommerce How to add a menu item into the administration area from a plugin

    本文转自:http://docs.nopcommerce.com/display/nc/How+to+code+my+own+shipping+rate+computation+method Go t ...

  2. Editor Scripting学习笔记之Menu Item

    主要用到: MenuItem属性 MenuCommand参数 可能用到: EditorApplication类 Selection类 GameObjectUtility类 FileUtil类 Undo ...

  3. Add an Item to the Navigation Control 将项目添加到导航控件

    In this lesson, you will learn how to add an item to the navigation control. For this purpose, the N ...

  4. Toolbar 和 CollapsingToolbarLayout一起使用时menu item无点击反应解决办法

    昨天一直在琢磨为什么Toolbar和CollapsingToolbarLayout一起使用时menu item无点击放应的原因,后来在stackoverflow上一条回答,说可能是Toolbar的背景 ...

  5. create-react-app 搭建的项目中,让 antd 通过侧边栏导航 Menu 的 Menu.Item 控制 Content 部分的变化

    第一种:BrowserRouter把Menu和Route组给一起包起来 <Router></Router> 标签要把Menu和Route组给一起包起来 修改src/index. ...

  6. could not execute menu item系统找不到指定的文件

    Wamp3.0.6 64bit,系统任务栏图标,左键,Apache菜单,httpd.conf,报错“could not execute menu item.....系统找不到指定的文件” 根据网上的搜 ...

  7. Difference between menu item types; Display, Output and Action in Dynamics Ax

    Difference between menu item types; Display, Output and Action in Dynamics Ax Developers often ask m ...

  8. cocos2d-x 3.2,Label,Action,Listener,Menu Item等简单用法

    转载自:http://blog.csdn.net/pleasecallmewhy/article/details/34931021 创建菜单(Menu Item) // 创建菜单 auto menuI ...

  9. Add an Item to the New Action 在新建按钮中增加一个条目

    In this lesson, you will learn how to add an item to the New Action (NewObjectViewController.NewObje ...

随机推荐

  1. mkdi---创建目录。

    mkdir命令用来创建目录.该命令创建由dirname命名的目录.如果在目录名的前面没有加任何路径名,则在当前目录下创建由dirname指定的目录:如果给出了一个已经存在的路径,将会在该目录下创建一个 ...

  2. PHP CURL HTTPS POST

    PHP CURL HTTPS POST function vpost($url,$data){ // 模拟提交数据函数    $curl = curl_init(); // 启动一个CURL会话    ...

  3. Swift vs C# Go OC

    Swift vs C#    mod=view&aid=21" target="_blank">http://www.swifthumb.com/porta ...

  4. android5.x加入sim1,sim2标识

    1,mobile_signal_group.xml  ..... <FrameLayout android:id="@+id/mobile_combo" android:la ...

  5. IsoAlgo3d - IDF/PCF pipeline 3d viewer

    IsoAlgo3d - IDF/PCF pipeline 3d viewer eryar@163.com Key Words. IDF, PCF, IsoAlgo, 3D 当前国际主流管道设计软件都可 ...

  6. 搭建个人博客 方式2 使用jekyll

    孙广东  2016.3.12 环境安装:1.通过 RailsInstaller  来安装 Ruby https://www.ruby-lang.org/zh_cn/documentation/inst ...

  7. CRSF Defense Using Content Injection Support By ModSecurity

    The most advanced and imaginative use of the content injection feature is that devised byRyan C. Bar ...

  8. OpenCV —— 矩阵和图像操作

    cvAbs , cvAbsDiff , cvAbsDiffS cvAdd , cvAddS , cvAddWeighted(可添加权重) #include <cv.h> #include ...

  9. 去除inline-block元素间距

  10. python2 python3 m2crypto 安装(rsa 私钥文件加密)

    转自作者:大道至简_Andy 原文链接:https://www.jianshu.com/p/b308357ef649 第一种方式:使用apt-get(以Python2版本进行测试的) sudo apt ...