可以跟踪到 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. uni-app 地图初用 map

    一.uni-app 地图初用 map 代码如下: <template> <view> <!-- <page-head :title="title" ...

  2. Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-qvc66dfs/supervisor/

    # 安装supervisor 出错 pip3 install supervisor # 解决 sudo pip3 install supervisor

  3. 循环GridControl所有行

    ; i < gridView1.RowCount; i++) { DataRowView row = (DataRowView)gridView1.GetRow(i); } gridView1是 ...

  4. xgboost参数调优的几个地方

    tree ensemble里面最重要就是防止过拟合.  min_child_weight是叶子节点中样本个数乘上二阶导数后的加和,用来控制分裂后叶子节点中的样本个数.样本个数过少,容易过拟合.  su ...

  5. HDU 2846 Repository (字典树 后缀建树)

    Repository Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total ...

  6. es65 跨模块常量

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. SpringBoot与Dubbo整合-项目搭建

    本章节建立生产者和消费者来演示dubbo的demo 生产者:springboot-dubbo-provider 和 消费者:springboot-dubbo-consumer 工程配置详解 Apach ...

  8. Scott Hanselman的问题-2

    .Net程序员面试 每个人都应知道篇 (回答Scott Hanselman的问题)   昨天回答了Scott Hanselman在他清单上关于C#那部分的题目,.Net 程序员面试 C# 语言篇 (回 ...

  9. 一台服务器安装运行多个Tomcat及注册服务

    项目需要,自己配置了一下,顺便分享出来. 1.下载对应版本Tomcat,这里下载Tomcat7.0.65.zip; 下载地址:http://archive.apache.org/dist/tomcat ...

  10. C#引用c++DLL结构体数组注意事项(数据发送与接收时)

    本文转载自:http://blog.csdn.net/lhs198541/article/details/7593045 最近做的项目,需要在C# 中调用C++ 写的DLL,因为C# 默认的编码方式是 ...