zoukankan      html  css  js  c++  java
  • 为什么需要注册OCX控件?

      转自:http://searchwindevelopment.techtarget.com/answer/Why-do-I-need-to-register-OCX-controls

       OCX's have to be registered due to the registry.  I realize that's a bit of a circular reference. OCX's are binary code that conforms to the Component Object Model (COM) programming model. The key tenant of COM is that they are only partially self-describing.

      When your program requests a COM object, it asks the Object Linking and Embedding (OLE) subsystem of the operating system for the object. OLE's job is to read the HKEY_CLASSES_ROOT key from the registry for the requested object. A Globally Unique Identifier (GUID), a 128-bit number, identifies the object itself. When an OCX registers itself, it declares it's GUID and where the OLE system can find that particular .OCX file. In essence, you can think of the registry as the translation layer.

      Since I can read minds, some of you are wondering what the difference is with .NET. Where a COM object is not self-describing, a .NET object is completely self-describing. Where a COM object has data in it's binary as well as the registry to describe it, a .NET object has every bit of information about itself inside the binary. (By the way, this information in .NET is called the meta-data.)

      With meta-data, anyone can load up a .NET object and using a technique called Reflection; you can find out exactly what methods and properties that object supports and call those methods and properties with the proper parameters. This works even if there are all sorts of custom data types and whatnot in the .NET object. With COM, the only way you can call unique methods on an object is to manually program them. The only way you can call methods and properties on a COM object is to have a priori knowledge those methods and properties and manually writing to code to call them. 

  • 相关阅读:
    在软硬件系统总体架构设计
    WCF服务重构
    步步为营 .NET 设计模式学习笔记 四、Singleton(单例模式)
    我爱编程
    对.NET初学者两个问题的个人见解
    郁闷的一本书《深入解析Windows操作系统》
    欢迎使用 PDF.NET 数据开发框架【转载】
    使用ASP.NET MVC2+PDF.NET 构建一个简单的新闻管理程序
    不使用DalFactory和IDAL,支持多种数据库应用
    Web开发人员非常有用的手册
  • 原文地址:https://www.cnblogs.com/144823836yj/p/7448052.html
Copyright © 2011-2022 走看看