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

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

?? ch04.htm

?? 用VC開發ACTIVEX書籍和隨書源碼
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--last modified on Tue, Apr 15, 1997 9:46 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 4</TITLE>
</HEAD>

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

<H1>Chapter 4<BR>
Creating ActiveX Automation Servers Using ATL</H1>

<UL>
	<LI><A HREF="#Heading1">Creating ActiveX Automation Servers Using ATL</A>
	<UL>
		<LI><A HREF="#Heading2">Creating the Basic Project</A>
		<LI><A HREF="#Heading3">Adding an Automation Interface to the Application</A>
		<UL>
			<LI><A HREF="#Heading4">Listing 4.1 ATLSERVER.IDL--IDL File for the ATL Server Sample</A>
		</UL>
		<LI><A HREF="#Heading5">Registry</A>
		<UL>
			<LI><A HREF="#Heading6">Listing 4.2 ATLCONTROLWIN.RGS--Sample Registry Script File
			for the</A><A HREF="#Heading7">CTracker Server Object</A>
			<LI><A HREF="#Heading8">Listing 4.3 TRACKER.RGS--Updated Tracker.rgs File</A>
		</UL>
		<LI><A HREF="#Heading9">Sample Server Support Code</A>
		<UL>
			<LI><A HREF="#Heading10">Listing 4.4 Tracker.H--Sample Server Support Code Added
			to the</A> <A HREF="#Heading11">Tracker Header File</A>
			<LI><A HREF="#Heading12">Listing 4.5 TRACKER.CPP--Sample Server Support Code Added
			to the Source File</A>
		</UL>
		<LI><A HREF="#Heading13">Adding Methods</A>
		<UL>
			<LI><A HREF="#Heading14">Listing 4.6 ATLSERVER.IDL--OutputLines Method Added to the
			IDL File by the ATL ClassWizard</A>
			<LI><A HREF="#Heading15">Listing 4.7 TRACKER.H--OutputLines Function Prototype Added
			to the</A>
			<LI><A HREF="#Heading16">Tracker.h File</A>
			<LI><A HREF="#Heading17">Listing 4.8 TRACKER.CPP--OutputLines Function Implementation
			Added </A><A HREF="#Heading18">to the Tracker.cpp File</A>
			<LI><A HREF="#Heading19">Listing 4.9 TRACKER.H--m_1Indent Member Variable Added to
			the</A> <A HREF="#Heading20">Class Definition</A>
			<LI><A HREF="#Heading21">Listing 4.10 TRACKER.CPP--Member Initialization in the Constructor</A>
			<LI><A HREF="#Heading22">Listing 4.11 TRACKER.CPP--OutputLines Function Implementation
			Added to the Source File Tracker.cpp</A>
		</UL>
		<LI><A HREF="#Heading23">Adding Properties</A>
		<UL>
			<LI><A HREF="#Heading24">Listing 4.12 TRACKER.IDL--Indent Property Added to the IDL</A>
			<LI><A HREF="#Heading25">Listing 4.13 TRACKER.H--Indent Property Function Pair Prototypes
			Added to the Tracker.h File</A>
			<LI><A HREF="#Heading26">Listing 4.14 TRACKER.CPP--Indent Property Function Pair
			Implementation Added to the Tracker.cpp File</A>
			<LI><A HREF="#Heading27">Listing 4.15 TRACKER.CPP--Indent Property Implementation</A>
		</UL>
		<LI><A HREF="#Heading28">Generating OLE Exceptions</A>
		<UL>
			<LI><A HREF="#Heading29">Listing 4.16 ATLSERVER.IDL--Error Enumeration Added to the
			IDL File</A>
			<LI><A HREF="#Heading30">Listing 4.17 TRACKER.CPP--Rich Error Information Added to
			Tracker</A>
			<LI><A HREF="#Heading31">Implementation</A>
		</UL>
		<LI><A HREF="#Heading32">Dual-Interface</A>
		<LI><A HREF="#Heading33">Generating Dual-Interface OLE Exceptions</A>
		<LI><A HREF="#Heading34">Server Instantiation Using C++</A>
		<LI><A HREF="#Heading35">Shared Servers</A>
		<UL>
			<LI><A HREF="#Heading36">Listing 4.18 STDAFX.H--Shared Object Support Classes and
			Macros</A>
			<LI><A HREF="#Heading37">Listing 4.19 TRACKER.H--Shared Server Support Added to Ctracker
			Class</A>
		</UL>
		<LI><A HREF="#Heading38">Single Instance Servers</A>
		<UL>
			<LI><A HREF="#Heading39">Listing 4.20 STDAFX.G--Single Instance Server Support Added
			to StdAfx.h</A>
			<LI><A HREF="#Heading40">Listing 4.21 TRACKER.H--Single Instance Server Support Added
			to CTracker Class</A>
		</UL>
		<LI><A HREF="#Heading41">From Here...</A>
	</UL>
</UL>

<P>
<HR SIZE="4">

<H1><A NAME="Heading1"></A>Creating ActiveX Automation Servers Using ATL</H1>

<UL>
	<LI><B>Server registration support</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Automation servers depend on the registry for information about how they are implemented
	and used.
	<P>
	<LI><B>Adding methods and properties</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Methods allow the user of the server to access specific functionality in the server.
	Properties provide a uniform mechanism for getting and setting the state of a server's
	data variables.
	<P>
	<LI><B>OLE exceptions</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Unlike MFC, ATL does not support OLE exceptions through a C++ exception; rather
	it takes advantage of OLE error mechanisms.
	<P>
	<LI><B>Dual-interface</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 ATL servers implement dual- interface as a standard feature of the application.
	<P>
	<LI><B>Creating servers using C++</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 C++ can be used to launch servers from the application in which they are defined.
	<P>
	<LI><B>Shared and single instance servers</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Using a server that is already running is usually the choice of the controller of
	the server, not the implementer. With a single instance server, the server implementer
	is responsible for the reuse of a server that is already running.
</UL>

<P>The ActiveX Template Library (ATL) was created to answer the need for lightweight
and fast ActiveX COM components. In addition to creating COM Objects and Controls,
ATL can be used to create Automation Servers with a minimum of effort and overhead.
ATL consists of a set of template classes that are a relatively new concept to most
developers; however, the focus of this chapter is on creating Automation Servers.
Please see your favorite C++ book or manual for more information regarding the definition
and use of templates.</P>
<P>ATL is intended to solve the problems of COM com-ponent development and is not
an attempt to be an all-encompassing class library for creating applications. ATL
was designed to work with other class libraries, such as MFC or the Standard Template
Library (STL), that provide basic classes for string manipulation, array, lists,
memory management, and so on. You, the developer, have the freedom to choose which
class library best suits your needs and combine it with ATL to create small, fast
COM applications. In this chapter, you will create a simple in-process Automation
Server using ATL and MFC for logging string data to a file. The use of MFC will allow
you to concentrate on how to implement your server rather than on how to find alternative
methods to functions and classes you are familiar with. You could just as easily
opt not to use MFC, but then you would have to use the Windows API directly to implement
anything related to the OS. As it is, using MFC will not add much to your application
in terms of size.</P>
<P>As you proceed through the chapter, you will expand on your implementation, highlighting
some of the more advanced concepts of Automation Server creation using ATL.
<H2><A NAME="Heading2"></A>Creating the Basic Project</H2>
<P>When creating an Automation Server, the first step is to create a <I>basic project
</I>upon which you will build your application's features and functionality. Like
MFC, ATL has an AppWizard for creating the basic ATL project.</P>
<P>From the <U>F</U>ile menu, select the <U>N</U>ew menu item. In the New dialog
(see fig. 4.1), select the Projects tab. The Projects tab allows you the opportunity
to define several aspects of how the application will be created, for example, the
type of application to create, the name of the application, and the location where
you want the project created. For the type, select ATL COM AppWizard; enter the Project
<U>n</U>ame ATLServer, and the Lo<U>c</U>ation will be <TT>C:\que\ActiveX\ ATLServer</TT>.
Click the OK button to start the ATL COM AppWizard so you can further define the
properties of your server. <A HREF="Art/04/dfig01.jpg"><B>FIG. 4.1</B></A> <I><BR>
Define the new ATL server project in the New dialog.</I></P>
<P>In the ATL COM AppWizard -- Step 1 of 1 dialog (see fig. 4.2), select a Server
Type of <U>D</U>ynamic Link Library (DLL), and check the Support <U>M</U>FC check
box. Click the <U>F</U>inish button to continue. <A HREF="Art/04/dfig02.jpg"><B>FIG.
4.2</B></A> <I><BR>
Define the basic architecture of the ATL COM object with the ATL COM AppWizard.</I></P>
<P>The New Project Information dialog (see fig. 4.3) is used to confirm the settings
that were selected for the project prior to the creation of the actual source files.
This is the last step in the ATL COM AppWizard. &quot;But wait,&quot; you say, &quot;I
haven't defined any of my server properties.&quot; The ATL COM AppWizard takes a
slightly different approach from that of MFC. Only the basic source files are created
with the AppWizard, the remainder of the project is defined by the ATL ObjectWizard--thus
allowing for much better control of the project implementation versus MFC since the
developer can add any number of ActiveX Servers, Controls, or plain COM objects after
the basic project is created. After you have confirmed your project settings, click
the OK button to close the ATL COM AppWizard and create the ATLServer project. <A
HREF="Art/04/dfig03.jpg"><B>FIG. 4.3</B></A> <I><BR>
Confirm the new project settings with the New Project Information dialog.</I></P>
<P>The ATL AppWizard generates all of the basic files that are needed to create a
DLL-based ATL Automation Server. Table 4.1 lists all of the files that are created
and a brief explanation of their purpose. 
<TABLE BORDER="1" WIDTH="100%">
	<CAPTION><B>Table 4.1 </B><SPACER TYPE="HORIZONTAL" SIZE="10"><B>Basic Source Files Created
		by the ATL AppWizard</B></CAPTION>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><B>Filename</B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP"><B>Description</B></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.clw</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VC++ project file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.cpp</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">The main application source file and entry point for the DLL.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.def</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Standard application DEF file. This file contains the function export declarations
			needed for all in-process servers.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.dsp</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VC++ project file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.dsw</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VC++ project file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.idl</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Interface Definition Language file, which is used to create the type library for
			the server.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.ncb</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">VC++ project file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServer.rc</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Standard resource file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">StdAfx.cpp</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Standard precompiled header source file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServerps.def</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Proxy/Stub DLL definition file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">ATLServerps.mk</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Proxy/Stub MK file.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP">StdAfx.h</TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Standard precompiled header file. All of the MFC-specific include files are added
			here.</TD>
	</TR>
</TABLE>

<H2><A NAME="Heading3"></A>Adding an Automation Interface to the Application</H2>
<P>To be an <I>Automation Server</I>,<I> </I>an application must contain at least
one or more <TT>IDispatch</TT>-based interfaces. You will use the ATL ObjectWizard
to add your automation server interfaces to your application. From the <U>I</U>nsert
menu, select the New <U>A</U>TL Object menu item. Within the ATL ObjectWizard dialog
(see fig. 4.4), select the Objects item in the left panel to display the types of
ATL components that can be added. Your implementation will be an Automation Server,
so select the Simple Object icon. See the ATL documentation for more information
on the other types of objects that can be created. Click the <U>N</U>ext button to

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区四区激情| 国内成+人亚洲+欧美+综合在线 | 亚洲一区av在线| 捆绑调教一区二区三区| 北条麻妃国产九九精品视频| 欧美优质美女网站| 日本一区二区三区免费乱视频| 亚洲精品中文在线影院| 国产精品一区二区在线看| 精品视频在线视频| 亚洲色图在线看| 懂色av一区二区在线播放| 日韩视频免费观看高清在线视频| 国产精品视频免费看| 日韩av不卡一区二区| 97se亚洲国产综合在线| 久久久精品综合| 看片网站欧美日韩| 欧美日韩综合一区| 一区二区在线观看免费视频播放 | 亚洲小少妇裸体bbw| 成人性视频免费网站| 日韩欧美123| 欧美aa在线视频| 欧美一区二区美女| 亚洲v精品v日韩v欧美v专区| 91福利社在线观看| 亚洲欧美激情视频在线观看一区二区三区| 狠狠色丁香婷综合久久| 日韩限制级电影在线观看| 亚洲成a天堂v人片| 欧美午夜精品电影| 亚洲不卡一区二区三区| 欧美日韩一区二区三区在线看| 亚洲情趣在线观看| 色综合亚洲欧洲| 亚洲免费资源在线播放| 一本色道久久综合亚洲aⅴ蜜桃 | 一本色道久久加勒比精品 | 日本韩国一区二区三区视频| 国产精品久久夜| 色综合视频在线观看| 一区二区久久久久| 欧美久久免费观看| 日本成人中文字幕| 亚洲精品一区二区三区香蕉| 激情综合色综合久久| 国产午夜精品久久| 97精品视频在线观看自产线路二| 日韩理论电影院| 欧美精品免费视频| 九九久久精品视频| 中国色在线观看另类| 91啪亚洲精品| 午夜精品一区二区三区三上悠亚| 5566中文字幕一区二区电影| 美女任你摸久久| 国产精品毛片大码女人| 一本色道久久加勒比精品| 日韩制服丝袜先锋影音| 精品国产一区二区三区av性色| 国产精品亚洲成人| 一区二区三区在线免费| 欧美一区二区三区人| 国产成人精品1024| 一区二区三区自拍| 久久丝袜美腿综合| 日本久久一区二区| 国产乱码一区二区三区| 亚洲精品中文在线观看| 欧美不卡一区二区三区| 97国产一区二区| 日本视频中文字幕一区二区三区 | 欧美一区二区三区啪啪| 成人免费视频免费观看| 午夜精品免费在线| 亚洲日本中文字幕区| 日韩欧美在线123| 99re这里只有精品首页| 麻豆精品在线播放| 亚洲国产精品久久人人爱| 国产三级精品三级在线专区| 欧美日本在线视频| 91美女在线看| 国产成人精品免费网站| 日本亚洲欧美天堂免费| 一区二区高清在线| 国产三区在线成人av| 日韩一级免费观看| 欧美亚洲国产怡红院影院| 成人国产在线观看| 国产二区国产一区在线观看| 男人的天堂亚洲一区| 亚洲成在人线免费| 一区二区欧美国产| 亚洲黄色免费网站| 国产精品不卡在线| 久久久久久**毛片大全| 日韩欧美专区在线| 欧美一区永久视频免费观看| 欧美伊人精品成人久久综合97| 99re亚洲国产精品| www.在线成人| 成人aaaa免费全部观看| 懂色av一区二区在线播放| 国产米奇在线777精品观看| 奇米亚洲午夜久久精品| 美女一区二区视频| 久久99热这里只有精品| 人人精品人人爱| 亚洲成人福利片| 樱花影视一区二区| 国产精品不卡视频| 亚洲美女在线一区| 国产精品亲子伦对白| 精品国产一区二区精华| 91精品国产麻豆| 欧美日韩国产在线播放网站| 亚洲成人免费av| 天天色 色综合| 亚洲伊人伊色伊影伊综合网| 亚洲少妇最新在线视频| 国产精品毛片大码女人| 日韩亚洲欧美中文三级| 日韩欧美国产不卡| 欧美一级国产精品| 欧美xxxxx裸体时装秀| 欧美一级精品大片| 日韩一区二区不卡| 日韩欧美另类在线| 欧美刺激午夜性久久久久久久| 欧美精品在线观看播放| 欧美日韩视频在线一区二区| 欧美一区二区女人| 日韩欧美国产高清| 精品国产精品网麻豆系列| 日韩精品中文字幕在线一区| 日韩视频在线永久播放| 亚洲国产精品黑人久久久| 国产亚洲欧洲997久久综合 | 91在线观看地址| 国产在线国偷精品产拍免费yy| 国产传媒欧美日韩成人| 91在线观看成人| 欧美三级在线视频| 精品日韩欧美在线| 久久久www成人免费毛片麻豆 | 国产91丝袜在线播放0| 国产老肥熟一区二区三区| 国产不卡在线播放| 成+人+亚洲+综合天堂| 欧美亚洲免费在线一区| 制服丝袜成人动漫| 日韩一区二区在线观看视频播放| 精品国产乱码久久久久久免费| 国产欧美日韩精品a在线观看| 亚洲精品免费看| 蜜桃传媒麻豆第一区在线观看| 国产精品自拍三区| 欧美最新大片在线看| 久久日韩粉嫩一区二区三区| 亚洲国产精品二十页| 亚洲国产精品久久不卡毛片| 久久99久久99精品免视看婷婷 | 国产一区二区美女| 99久久国产综合精品麻豆| 欧美乱妇20p| 国产精品乱码人人做人人爱| 激情欧美一区二区三区在线观看| 韩国中文字幕2020精品| a级精品国产片在线观看| 欧美精品一二三| 久久精品视频在线看| 日韩精品视频网站| 成人黄色大片在线观看| 欧美另类z0zxhd电影| 国产精品色噜噜| 激情综合色播五月| 欧日韩精品视频| 国产丝袜在线精品| 日韩av二区在线播放| 色哟哟在线观看一区二区三区| 91麻豆精品国产91久久久更新时间| 国产午夜一区二区三区| 午夜久久电影网| 色综合久久久久| 欧美激情在线一区二区| 偷窥少妇高潮呻吟av久久免费| 国产精品1区二区.| 欧美一区二区国产| 中文字幕一区二区三区精华液| 精品一区二区三区不卡| 欧洲视频一区二区| 国产精品久久久久精k8| 韩国成人精品a∨在线观看| 日韩欧美中文一区| 日韩福利视频网| 欧美精品xxxxbbbb| 亚洲一区自拍偷拍| 777午夜精品视频在线播放|