现在的位置: 首页 > 综合 > 正文

Component Tools Guide略读笔记(1):ActiveX Components Overview, Using and Creating ActiveX Controls

2013年09月30日 ⁄ 综合 ⁄ 共 3299字 ⁄ 字号 评论关闭

来自MSDN-2001-OCT: Visual Tools and Languages/Visual Studio 6.0 Documentation/Visual Basic Documentation/Using Visual Basic/Component Tools Guide/

1. 概述

(1) 《部件工具指南》主要讲how to create and use 基于COM标准互操作的components.

By virtue of this standard, you can design applications from components that communicate through a common set of interfaces.

(2) 学习目的和方法:看看这本书里哪些是开发树类可能需要用到的技术,标下路标不细看;用不到的超略看。

(3) 计划时间:两天。

(4) 这种颜色的文字表示需要进一步了解的知识点

2. ActiveX Controls Overview

(1) ActiveX controls have the file name extension .ocx.

(2) ActiveX Controls File Names: 一个完整的列表关于ActiveX控件及对应文件

(3) ActiveX Control Class:一个完整的列表关于ActiveX控件及对应类名

(4) 发布使用ActiveX Control的程序的话,最好在安装程序里拷贝:The Visual Basic run-time file;Any .ocx files;Additional DLLs, as required by your application or by ActiveX controls.

你的安装程序需要copy all required .ocx files into the user's /Windows/System directory并且注册它们。

3. Using the ActiveX Controls

(1) 目录页罗列了所有ActiveX控件的主要功能。

(2) 可能需要了解的控件:DataRepeater;MsChart

4. ActiveX Components Overview

(1) An ActiveX component: .exe, .dll, or .ocx file

(2) OOP is concerned with creating objects, while ActiveX is concerned with making objects work together.

所有支持ActiveX技术的编程工具都可以重用ActiveX部件;而C++类只能被其他C++程序员重用。

(3) “ActiveX component" 过去似乎叫 oh-lay ser-ver

5. Which Type of Component Should I Build?

(1) If you need an invisible component that provides a service, you’ll want to build a code component — either an ActiveX Exe or an ActiveX DLL.

If you need a component that can run in the same process with your application, you’ll want an ActiveX DLL. An example of this would be a component that performs complex calculations.

If you need a component that can serve multiple applications and can run on a remote computer, you’ll want an ActiveX Exe. For example, a business rules server that enforces tax rules would best be implemented as an ActiveX Exe.

(2) If you need a visible component that can be dropped into an application at design time, you’ll want to build an ActiveX control.

(3) If you need a visible component that can take over an application window at run time, choose an ActiveX document.

(4) 如果你想通过C#和VB.net来做ActiveX的请,我劝你尽快打消这个念头。.net认为ActiveX技术是过时的,所以C#和Vb.net都做不了ActiveX。C#和VB.net可以做类似的东西,但它不叫ActiveX而是叫windows控件,前提是客户端机器必须安装了.net framework才能运行。但是,目前很多机器都没有安装.net framework,至少也要等到Vista普及得差不多的时候,ActiveX技术才可能退出历史舞台。

6. Features for Building Components

(1) Objects provided by components can raise events.

(2) Components can be data-aware, binding directly to any source of data without the need for a data control.

(3) Friend functions allow the objects provided by a component to communicate with each other internally, without exposing that communication to applications that use those objects.

(4) The Implements keyword lets you add standard interfaces to your objects. These common interfaces enable polymorphic behavior for objects provided by a component, or for objects provided by many different components.

(5) You can use enumerations to provide named constants for all component types.

(6) You can choose a default property or method for each class of object your component provides.

(7) You can allow users of your component to access the properties and methods of a global object without explicitly creating an instance of the object. (这个貌似是ActiveX dll 和ActiveX exe的功能)

7. 章节安排

(1) 和开发ActiveX控件相关的章节:"Creating an ActiveX Control", "Building ActiveX Controls", "Creating Property Pages for ActiveX Controls", "General Principles of Component Design", "Debugging, Testing, and Deploying Components"

(2) code components以前叫OLE Automation servers

8. Creating an ActiveX Control

(1) 这一章有个step by step的例子可以看。

(2) Control Creation Recap这一节总结了所有的常规步骤。

9. 问题

(1) AcessVBA里的子窗体可以用哪个控件代替?或者是否可以直接引用到VB6里?

(2) 看vbaccelerator, codeproject等上是否有可用的扩展树控件的代码,或者直接可用的树控件。以及其他著名网站找找。至少借鉴一下它们的程序框架。

抱歉!评论已关闭.