asm, c, c++ are my all
-- Core In Computer
posts - 139,  comments - 123,  trackbacks - 0
/********************************************\
|    欢迎转载, 但请保留作者姓名和原文链接, 祝您进步并共勉!     |
\********************************************/


读VC++内幕之体悟 - 11
作者: Jerry Cat
时间: 2006/09/10
链接:http://www.cppblog.com/jerysun0818/archive/2006/09/10/12225.html


通过在函数OnInitDialog中加入AfxOleLockControl(someActivexControl.GetClsid());可以把ActiveX控件锁定在内存中,这样,除非程序退出或者调用了AfxOleUnlockControl,ActiveX控件将总在内存中。
posted on 2006-09-10 20:20 Jerry Cat 阅读(634) 评论(3)  编辑 收藏 引用

FeedBack:
# re: 读VC++内幕之体悟 - 11
2006-09-10 20:48 | chenger
就这么一点?  回复  更多评论
  
# re: 读VC++内幕之体悟 - 11
2006-09-10 21:00 | Jerry Cat
积少成多, 聚砂成塔!  回复  更多评论
  
# re: 读VC++内幕之体悟 - 11
2006-09-10 22:49 | 万连文
Locks the class factory of the specified control so that dynamically created data associated with the control remains in memory. This can significantly speed up display of the controls. For example, once you create a control in a dialog box and lock the control with AfxOleLockControl, you do not need to create and kill it again every time the dialog is shown or destroyed. If the user opens and closes a dialog box repeatedly, locking your controls can significantly enhance performance. When you are ready to destroy the control, call AfxOleUnlockControl.
根据msdn解释和参数来看,恐怕锁住的不是控件而是控件对应的类厂,仅仅一个clsid不是实例对象,充其量只是决定控件的类型信息。这样好处应该是多次创建带来的,COM组件创建需要类厂。  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理



<2007年11月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

常用链接

留言簿(7)

随笔档案

最新随笔

搜索

  •  

最新评论

阅读排行榜

评论排行榜