`
film
  • 浏览: 225305 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

PRB: OnInitialUpdate() May Be Called More Than Once

 
阅读更多
<script type="text/javascript">function loadTOCNode(){}</script>
Article ID : 103982
Last Review : November 21, 2006
Revision : 2.1
This article was previously published under Q103982

SYMPTOMS

<script type="text/javascript">loadTOCNode(1, 'symptoms');</script>
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.
在SDI视图应用程序中,CView对象的OnInitialUpdate()函数可能被多次调用。当视图窗口被创建的时候,任何只需要做一次的初始化工作应该被移到OnCreate()中执行,不是在OnInitialUpdate()中执行。

MORE INFORMATION

<script type="text/javascript">loadTOCNode(1, 'moreinformation');</script>
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()函数都会被调用一次。

版权声明:本文为博主原创文章,未经博主允许不得转载。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics