亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch12.htm

?? 用vc開發activex
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--last modified on Tue, Apr 15, 1997 11:44 AM-->
<HTML>

<HEAD>
<!-- This document was created from RTF source by rtftohtml version 3.0.1 -->

	<META NAME="GENERATOR" Content="Symantec Visual Page 1.0">
	<META NAME="Author" Content="Steph Mineart">
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
	<TITLE>Chapter 12</TITLE>
</HEAD>

<BODY TEXT="#000000" BGCOLOR="#FFFFFF">

<H1>Chapter 12<BR>
Creating ActiveX COM Objects and Custom Interfaces Using MFC</H1>

<UL>
	<LI><A HREF="#Heading1">Creating ActiveX COM Objects and Custom Interfaces Using
	MFC</A>
	<UL>
		<LI><A HREF="#Heading2">Anatomy of a COM Object</A>
		<LI><A HREF="#Heading3">Tools Needed for Building COM Objects</A>
		<UL>
			<LI><A HREF="#Heading4">MIDL Compiler</A>
			<LI><A HREF="#Heading5">GUIDGEN</A>
			<LI><A HREF="#Heading6">RegEdit</A>
			<LI><A HREF="#Heading7">Registration Server</A>
			<LI><A HREF="#Heading8">Adding the Tools to the Visual C++ Development Environment</A>
		</UL>
		<LI><A HREF="#Heading9">Defining COM Interfaces Using IDL</A>
		<UL>
			<LI><A HREF="#Heading10">Creating the IFISH Project</A>
			<LI><A HREF="#Heading11">Creating the Interface Definition</A>
			<LI><A HREF="#Heading12">Listing 12.1 IFISH.IDL--Interface Definition for IFish</A>
			<LI><A HREF="#Heading13">Listing 12.2 IBASS.IDL--Interface Definition for IBass</A>
			<LI><A HREF="#Heading14">Compiling the Interface Definition Files</A>
			<LI><A HREF="#Heading15">Creating a Definition File</A>
			<LI><A HREF="#Heading16">Listing 12.3 DLL LIBRARY--Definition File for IFISH.DLL</A>
			<LI><A HREF="#Heading17">Adding the RPC Libraries to the Interface Project</A>
			<LI><A HREF="#Heading18">Listing 12.4 RPCHELP.C--Compiler Pragmas Used for Referencing
			RPC Libraries</A>
			<LI><A HREF="#Heading19">Registering the Interfaces</A>
			<LI><A HREF="#Heading20">Listing 12.5 IFISH.REG--Contexts of IFISH.REG File Used
			to Register the Interfaces Supported by the IFISH.DLL</A>
		</UL>
		<LI><A HREF="#Heading21">Implementing the Interface</A>
		<UL>
			<LI><A HREF="#Heading22">Using the Visual C++ AppWizard to Create the COM Object</A>
			<LI><A HREF="#Heading23">Accessing In-Process COM Objects</A>
			<LI><A HREF="#Heading24">Listing 12.6 BASS.DEF--BASS Definition File with the COM
			Support Functions Explicitly Exported</A>
			<LI><A HREF="#Heading25">Listing 12.7 BASS.CPP--DLlGetClassObject Implementation
			Code Inserted by the MFC AppWizard</A>
			<LI><A HREF="#Heading26">Listing 12.8 DLLCanUnloadNow--Implementation Code Inserted
			by the MFC AppWizard</A>
			<LI><A HREF="#Heading27">Listing 12.9 DllRegisterServer--Implementation Code Inserted
			by the MFC AppWizard</A>
			<LI><A HREF="#Heading28">Creating a Class that Implements COM Interfaces</A>
			<LI><A HREF="#Heading29">Listing 12.10 COMMACROS.H--COM Macros Used for Accessing
			the IUnknown Implementation of CCmdTarget</A>
			<LI><A HREF="#Heading30">Listing 12.11 BASSID.H--Header File bassid.h that Contains
			the Implementation of CLSID for the CBass Class</A>
			<LI><A HREF="#Heading31">Listing 12.12 BASS.H--Header File for the CBass Class (bass.h)</A>
			<LI><A HREF="#Heading32">Listing 12.13 BASS.CPP--Complete Implementation File for
			CBass object (Bass.cpp)</A>
		</UL>
		<LI><A HREF="#Heading33">Using the Interface</A>
		<UL>
			<LI><A HREF="#Heading34">OLE Initialization and Shutdown Functions</A>
			<LI><A HREF="#Heading35">Listing 12.14 COMTEST.CPP--Initialization and Removal of
			OLE Libraries within an MFC Application</A>
			<LI><A HREF="#Heading36">COM Object Access Functions</A>
			<LI><A HREF="#Heading37">Listing 12.15 Comtestview.cpp--Test Function Used for Accessing
			the IFish and IBass Interfaces</A>
		</UL>
		<LI><A HREF="#Heading38">From Here...</A>
	</UL>
</UL>

<P>
<HR SIZE="4">

<H1><A NAME="Heading1"></A>Creating ActiveX COM Objects and Custom Interfaces Using
MFC</H1>

<UL>
	<LI><B>Supporting COM with MFC</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 While MFC does not utilize COM directly, the MFC architects did provide support
	mechanisms that make adding COM functionality an easy task.
	<P>
	<LI><B>Adding COM tools to the Visual C++ development environment</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 The implementation of COM Objects requires new tools, such as the MIDL compiler,
	that are outside the scope of traditional application development.
	<P>
	<LI><B>Creating a basic Component Object using MFC</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Examine the implementation and details of the two types of component objects, in-process
	(DLL) and out-of-process (EXE).
	<P>
	<LI><B>Defining a COM interface using the Interface Definition Language (IDL)</B>
	
<SPACER TYPE="VERTICAL" SIZE="2">
 The Interface Definition Language is used for defining your COM Object interface.
	<P>
	<LI><B>Setting up and installing COM Objects</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Installing and using a COM Object is a straightforward process, but you need to
	be aware of a few trouble spots.
</UL>

<P>ActiveX is a strategic technology base for Internet programming and distributed
computing. While ActiveX is the successor for OLE (Object Linking and Embedding),
OLE still forms the foundation of ActiveX programming. The basis for ActiveX is to
provide an object-oriented solution for solving problems encountered in developing
operating systems and applications. ActiveX provides the specifications necessary
to create component software that ultimately benefits the computing industry.</P>
<P>At the core of ActiveX is an extremely powerful and extensible architecture called
the <I>Component Object Model (COM)</I>. COM provides a simple yet elegant solution
for solving complex software problems such as accessing objects and services outside
of application boundaries and version control. COM solves these problems through
the use of binary components that are running in the system rather than by developing
source code components within an application.</P>
<P>If you are using the Visual C++ compiler from Microsoft, chances are very high
that you are also using the Microsoft Foundation Classes (MFC) as the building blocks
for your applications and components. MFC is a powerful set of base classes that
provide a framework of abstractions into the Windows SDK for developing Win32 applications
and components.</P>
<P>Classes within the MFC framework are not directly derived from COM interfaces.
However, the architects of MFC have provided direct support for adding COM to any
MFC-based component or application. The roots for supporting COM within MFC lie in
wrappers called <I>Interface maps. </I>Interface maps are similar to message maps
(which are used for distributing Windows messages to MFC classes) in both concept
and execution.
<H2><A NAME="Heading2"></A>Anatomy of a COM Object</H2>
<P>COM Objects give software developers the ability to leverage object-oriented software
techniques for solving application and operating system development issues. The COM
specification is not geared toward a specific language, although C++ is a natural
choice when developing COM Objects. Four basic components compose a COM Object:

<UL>
	<LI>Classes--A <I>class</I> is a data structure with a set of interfaces used for
	accessing and manipulating the data structure. This definition is analogous to C++
	class. The difference is that COM allows a class created in any language to be registered
	with the operating system and to be used in a language-independent manner.
	<P>
	<LI>Objects--An <I>object</I> is an instance of a class created during program execution.
	In C++, an object is typically created via the <TT>new</TT> operator. When using
	COM, COM Objects are created through the function <TT>CoCreateInstance</TT>. Many
	instances of an object can be created.
	<P>
	<LI>Interfaces--An <I>interface </I>is a group of functions (often called methods)
	that are part of a class. The interface functions are used to directly manipulate
	the data in a class. ActiveX is based on a set of COM interfaces. Of the set of ActiveX
	interfaces, the two that must be supported by COM Objects are <TT>IUnknown</TT> and
	<TT>IClassFactory</TT>.
	<P>
	<LI>GUIDs--A GUID (Global Unique Identifier) is an 8-byte number that provides a
	unique identifier for each COM Object. <TT>GUID</TT>s are generated by a tool called
	<TT>GUIDGEN</TT>. Each COM class <I>must</I> have two <TT>GUID</TT>s, one for the
	Class ID and one for the Interface ID.
</UL>

<P>The <I>class ID </I>(<TT>CLSID</TT>) is an identifier for the COM class. This
key is registered in the Windows Registry and contains a pointer (path) to where
the DLL (Dynamic Link Library) or EXE containing the class can be located. The <TT>CLSID</TT>
can be found in the Windows Registry under the path HKEY_CLASSES_ROOT\CLSID.</P>
<P>The <I>Interface ID </I>(<TT>IID</TT>) is an identifier for the interface to the
class. The <TT>IID</TT> is used by applications to query and invoke the methods into
the class. The <TT>IID</TT> is also contained in the Windows Registry and can be
found in the path HKEY_CLASSES_ROOT\Interface. Figure 12.1 illustrates the relationship
among class, interfaces, and <TT>IID</TT>. <BR>
<BR>
<A HREF="Art/12/ifig01.jpg"><B>FIG. 12.1</B></A> <BR>
<I>Relationship of COM Classes and Interfaces.</I></P>
<P>What COM provides to software developers is an object-oriented solution for building
and maintaining software solutions. Programmers using non-object-oriented languages
such as Visual Basic can develop and use COM components to build software solutions.</P>
<P>COM also provides a unique solution to the version control problems present in
many of today's software solutions. Since COM Objects are binary components, developers
do not have to worry about new or updated versions of a component being placed on
a computer where their application is running. The reason for this is that COM deals
with interfaces. If an interface is enhanced, new methods can be added to the interface,
or additional interfaces can be obtained without breaking an existing application.
COM's solution to version control provides a great method for upgrading applications
while preserving legacy systems.
<H2><A NAME="Heading3"></A>Tools Needed for Building COM Objects</H2>
<P>When creating your COM Objects, a few tools must be installed on your computer.
Most of these tools are automatically installed as part of the Visual C++ development
environment.
<H3><A NAME="Heading4"></A>MIDL Compiler</H3>
<P>The Microsoft MIDL compiler is now a standard component of the Microsoft Visual
C++ environment. The MIDL compiler compiles COM interface definitions into C code,
which is then compiled into the project by the Visual C++ compiler. Figure 12.2 illustrates
the purpose of the MIDL compiler. <B><BR>
<BR>
</B><A HREF="Art/12/ifig02.jpg"><B>FIG. 12.2</B></A> <I><BR>
Inputs and outputs of the MIDL compiler.</I></P>
<P>The MIDL compiler also provides support for marshaling interfaces across process
boundaries. Starting with Visual C++ 4.0, the MIDL compiler was shipped as a standard
component of Visual C++. The MIDL compiler is also available with the Win32 SDK from
Microsoft.
<H3><A NAME="Heading5"></A>GUIDGEN</H3>
<P><TT>GUIDGEN</TT> is a tool used to generate Global Unique Identifiers (<TT>GUID</TT>),
which can be used for Interface IDs, Class IDs, or any other 128-bit <TT>UUID</TT>,
such as an <TT>RPC</TT> interface. <TT>GUIDGEN</TT> is installed when the OLE development
option is selected during the Visual C++ installation. When <TT>GUIDGEN</TT> is run,
you must select the proper format for the <TT>UUID</TT> and then press the New <TT>GUID</TT>
button to copy the <TT>UUID</TT> to the Windows Clipboard. After running the <TT>GUIDGEN</TT>
application, the resulting <TT>GUID</TT> is pasted from the Clipboard into the code
that needs a <TT>GUID</TT>. <BR>
<BR>
<IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>NOTE:</B> The tool <TT>GUIDGEN</TT> is also installed by default if the option
	Typical is selected during the Visual C++ 5.0 installation.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0">
<H3><A NAME="Heading6"></A>RegEdit</H3>
<P><TT>RegEdit</TT> or the registration editor is a standard component of both the
Windows 95 and Windows NT operating systems. The registration editor is used for
browsing and altering operating system and application settings. The registration
editor can also be used for installing and registering your COM Objects. <BR>
<BR>
<IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>CAUTION:<BR>
	</B><TT>RegEdit</TT> is a powerful tool and must be used with extreme caution by
	experienced users. If used improperly, systems can be damaged, resulting in a loss
	of data or a malfunctioning computer.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"><BR>
<BR>
In Windows 95, this program is called regedit.exe. In Windows NT, this program is
called regedt32.exe.
<H3><A NAME="Heading7"></A>Registration Server</H3>
<P>The <I>registration server </I>is an application that can be used to register
the settings of a COM Object in the Windows registry without the need to create a
separate registration file. The application is called regsvr32.exe and is automatically
installed if the OLE development option is selected during Visual C++ installation

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲国产视频在线| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国内精品视频一区二区三区八戒| eeuss鲁片一区二区三区在线观看| 精品视频免费看| 中文字幕中文字幕一区二区| 人人爽香蕉精品| 欧美性猛交xxxx黑人交| 日本一区二区三区久久久久久久久不 | 欧美日韩国产一级| 亚洲欧美一区二区在线观看| 极品少妇xxxx精品少妇| 日韩精品一区二区三区在线| 国产精品久久久久久户外露出 | 欧美极品美女视频| 久久99热99| 91麻豆精品国产综合久久久久久| 日本一区二区在线不卡| 韩国一区二区三区| 精品999在线播放| 久久69国产一区二区蜜臀| 在线观看亚洲一区| 亚洲综合精品久久| 色哟哟欧美精品| 亚洲另类春色校园小说| 色呦呦国产精品| 亚洲香蕉伊在人在线观| 色中色一区二区| 亚洲激情六月丁香| 欧美性生活大片视频| 性久久久久久久| 6080yy午夜一二三区久久| 图片区小说区国产精品视频| 欧美日韩综合不卡| 琪琪一区二区三区| 欧美va亚洲va香蕉在线| 久久99国产精品免费网站| 久久久久久久久免费| 国产不卡高清在线观看视频| 国产精品私人影院| 99麻豆久久久国产精品免费| 亚洲欧美日本韩国| 欧美日韩亚洲综合在线 | 国产主播一区二区三区| 久久免费偷拍视频| 国产大陆精品国产| 亚洲视频一区二区在线| 欧美视频完全免费看| 日韩va亚洲va欧美va久久| 久久男人中文字幕资源站| 国产91精品一区二区麻豆网站| 国产精品美女久久久久高潮| 在线视频观看一区| 久草在线在线精品观看| 中文字幕不卡在线| 欧美日韩在线综合| 精品在线播放午夜| 国产精品久久久久久久久免费桃花 | 国产网红主播福利一区二区| 成人黄色网址在线观看| 亚洲激情成人在线| 欧美r级电影在线观看| jiyouzz国产精品久久| 视频一区视频二区中文| 久久久久高清精品| 在线精品亚洲一区二区不卡| 久久精品999| 成人免费在线观看入口| 日韩欧美国产一区二区在线播放| 国产成人精品影视| 视频一区二区国产| 国产精品美女久久久久aⅴ| 欧美精品粉嫩高潮一区二区| 国产精品亚洲午夜一区二区三区| 天涯成人国产亚洲精品一区av| 久久久久久久免费视频了| 欧美日韩精品二区第二页| 成人av在线一区二区三区| 日韩1区2区3区| 亚洲欧美日韩国产成人精品影院| 精品欧美一区二区三区精品久久| 在线视频中文字幕一区二区| 国产乱子伦一区二区三区国色天香| 亚洲在线观看免费| 亚洲国产精品国自产拍av| 3d动漫精品啪啪一区二区竹菊| 99精品视频在线免费观看| 韩国女主播成人在线观看| 亚洲国产va精品久久久不卡综合| 国产精品麻豆99久久久久久| 精品日韩一区二区三区| 欧美美女网站色| 欧美中文字幕不卡| 成人av在线播放网站| 国产乱人伦精品一区二区在线观看 | 国产电影一区在线| 久久成人综合网| 视频精品一区二区| 亚洲一区二区三区三| 自拍偷拍亚洲激情| 国产精品国产三级国产aⅴ入口 | 在线电影院国产精品| 91色在线porny| 成人精品国产福利| 成人午夜又粗又硬又大| 国产成人欧美日韩在线电影| 久久国产剧场电影| 国产中文一区二区三区| 精品一二三四区| 九九**精品视频免费播放| 久久av资源站| 国产精品影视天天线| 一本久道久久综合中文字幕| 国产婷婷色一区二区三区四区 | 91精品国产欧美一区二区18| 欧美熟乱第一页| 欧美色图第一页| 欧美日韩一区二区电影| 欧美一区二区三区四区高清| 91精品国产入口在线| 日韩美女在线视频| 精品久久久久一区二区国产| 久久午夜国产精品| 国产欧美va欧美不卡在线| 国产精品国产自产拍高清av| 一区二区三区四区在线播放| 亚洲第一在线综合网站| 免费日本视频一区| 国产精品小仙女| 一本色道久久综合狠狠躁的推荐 | 99精品视频免费在线观看| 一本久道久久综合中文字幕| 在线观看91精品国产入口| 欧美一区二区私人影院日本| 久久久久久一级片| 亚洲美女精品一区| 天堂成人免费av电影一区| 国产一区日韩二区欧美三区| 成人高清在线视频| 欧美四级电影网| 久久午夜羞羞影院免费观看| 亚洲色图制服诱惑| 免费看日韩精品| 成人午夜碰碰视频| 在线电影一区二区三区| 国产午夜亚洲精品羞羞网站| 亚洲一区二区黄色| 国产在线麻豆精品观看| 91福利国产精品| 久久久久99精品一区| 亚洲妇女屁股眼交7| 国产成人免费视频精品含羞草妖精| 色综合久久中文字幕综合网| 日韩一级欧美一级| 一区二区视频免费在线观看| 男人操女人的视频在线观看欧美| 成人免费视频视频| 日韩欧美色电影| 亚洲乱码国产乱码精品精小说 | 欧美性大战久久久久久久蜜臀| 91精品国产综合久久久蜜臀粉嫩| 国产午夜一区二区三区| 婷婷成人综合网| 99精品国产91久久久久久| 欧美电影免费提供在线观看| 亚洲国产精品久久不卡毛片 | 一区二区三区欧美亚洲| 国产美女一区二区三区| 91麻豆精品久久久久蜜臀| 亚洲色图色小说| 国产大陆精品国产| 日韩一二三四区| 午夜不卡av免费| 91黄色激情网站| 中文字幕欧美日本乱码一线二线| 奇米一区二区三区av| 91高清在线观看| 国产精品成人网| 国产精品一卡二卡| 欧美xxxx老人做受| 日韩不卡一区二区| 欧美高清视频在线高清观看mv色露露十八 | 九色porny丨国产精品| 欧美电影在线免费观看| 亚洲成人免费在线| 91福利视频久久久久| 综合精品久久久| 99久久综合国产精品| 国产亚洲精品aa| 国产一区二区在线观看免费| 日韩欧美中文字幕一区| 丝袜亚洲另类丝袜在线| 欧美精品精品一区| 日本一不卡视频| 日韩一区二区三| 久久不见久久见免费视频7| 欧美不卡在线视频| 久草这里只有精品视频| 久久亚区不卡日本| 大桥未久av一区二区三区中文|