OnInitialUpadate()可能被多次调用,今天中招了

来源:互联网 发布:天猫实时数据 编辑:程序博客网 时间:2024/05/16 14:03

PRB: OnInitialUpdate() May Be Called More Than Once

Article ID : 103982 Last Review : November 21, 2006 Revision : 2.1
This article was previously published under Q103982

SYMPTOMS

The OnInitialUpdate() function of a CView object in a single document interface (SDI) application may be called more than once. Any initialization that needs to be done only when the view's window is created should be done in the OnCreate() message handler instead of in the OnInitialUpdate() function.
CView对象的OnInitialUpdate()函数在SDI视图应用程序中可能被多次调用。当视图窗口被创建的时候任何只需要做一次的初始化工作应该被移到OnCreate()中执行,不是在OnInitialUpdate()中执行。

MORE INFORMATION

In an SDI application, a single CView object is created to display a view of the document. When the user changes the document, the data in the CDocument is cleared using CDocument::DeleteContents(), and data for the new document is read into the CDocument object. Then the view is updated by sending a WM_INITIALUPDATE message to the view's window, which calls the OnInitialUpdate() function. Therefore, every time the user changes documents, the OnInitialUpdate() function for the view is called.
在一个SDI应用中,单个的CView对象被创建用来显示一个document的视图。当用户切换document的时候,在CDocument中储存的数据被函数CDocument::DeleteContents()清空,新document的数据被加载到CDocument对象中。然后,通过发送一个WM_INITIALUPDATE 消息,使得视图被更新,这个时候会调用 OnInitialUpdate()函数。因此,每一次,用户切换document, OnInitialUpdate()函数都会被调用一次。

 
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 头发油就掉头发怎么办 2岁儿童头发稀少怎么办 1岁宝宝头发稀少怎么办 头发又细又油怎么办 斑秃长了又掉怎么办 2岁宝贝头发稀少怎么办 25岁小伙掉头发怎么办 头发又细又软怎么办 甲减引起掉头发怎么办 掉头发严重怎么办40岁 4岁宝宝头发稀少怎么办 25岁头发顶脱发怎么办 头发细又少和软怎么办 头顶上头发少怎么办呢 3岁宝贝头发稀少怎么办 2岁幼儿头发稀少怎么办 小孩头发太少了怎么办 头发少盘丸子头怎么办 油头发掉的厉害怎么办 头顶头发长得慢怎么办 每次洗头发都掉很多头发怎么办 拔了头发不长怎么办 6岁儿童头发稀少怎么办 2岁宝宝胆子小怎么办 坐到小孩的头怎么办 托班幼儿不刷牙怎么办 两岁的宝宝蛀牙怎么办 小孩在学校被打怎么办 油画棒画在墙上怎么办 宝宝把蜡笔吃了怎么办 吃鸡更新了怎么办开始 数字画涂料干了怎么办 广告画颜料干了怎么办 宝宝断奶后瘦了怎么办 腿一个粗一个细怎么办 两条小腿不一样粗怎么办 两岁宝宝坐不了怎么办 q糖孩子吃多了怎么办 q糖孩子吃的太多怎么办 ps图层不能覆盖怎么办 孩子的字写的不好怎么办