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

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

?? ch08.htm

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

<BODY BACKGROUND="../images/r2harch.gif" TEXT="#000000" BGCOLOR="#FFFFFF">

<H1>Chapter 8<BR>
Using ATL to Create a Basic ActiveX Control</H1>

<UL>
	<LI><A HREF="#Heading1">Using ATL to Create a Basic ActiveX Control</A>
	<UL>
		<LI><A HREF="#Heading2">Creating the Basic Control Project</A>
		<LI><A HREF="#Heading3">Control Registration</A>
		<UL>
			<LI><A HREF="#Heading4">Listing 8.1 ATLCONTROLWIN.RGS--Sample Registry Script File
			for the CATLControlWin Control Class</A>
		</UL>
		<LI><A HREF="#Heading5">Creating Methods</A>
		<UL>
			<LI><A HREF="#Heading6">Listing 8.2 ATLCONTROLWIN.H--Alignment Enumeration Include
			File and Member Variables Added to Class Definition</A>
			<LI><A HREF="#Heading7">Listing 8.3 ALIGNMENTENUMS.H--Alignment Enumeration Include
			File</A>
			<LI><A HREF="#Heading8">Listing 8.4 ATLCONTROLWIN.H--Member Variable Initialization</A>
			<LI><A HREF="#Heading9">Listing 8.5 ATLCONTROLWIN.CPP--CaptionMethod Implementation</A>
		</UL>
		<LI><A HREF="#Heading10">Properties</A>
		<UL>
			<LI><A HREF="#Heading11">Creating Normal User Defined Properties</A>
			<LI><A HREF="#Heading12">Listing 8.6 ATLCONTROL.IDL--Dispid Enumeration Added to
			the IDL File to Aid in the Support of Properties in the Control</A>
			<LI><A HREF="#Heading13">Listing 8.7 ATLCONTROLWIN.CPP--Alignment Property Get/Put
			Method Implementation</A>
			<LI><A HREF="#Heading14">Creating Parameterized User Defined Properties</A>
			<LI><A HREF="#Heading15">Listing 8.8 ATLCONTROL.IDL--Update the IDL File to Support
			the Parameterized Property</A>
			<LI><A HREF="#Heading16">Listing 8.9 ATLCONTROLWIN.CPP--get_CaptionProp Implementation</A>
			<LI><A HREF="#Heading17">Listing 8.10 ATLCONTROLWIN.CPP--SetCaptionProp Implementation</A>
			<LI><A HREF="#Heading18">Creating Stock Properties</A>
			<LI><A HREF="#Heading19">Listing 8.11 ATLCONTROL.IDL--Add the Constant DISPID_BACKCOLOR
			to the IDL to Support the BackColor Stock Property</A>
			<LI><A HREF="#Heading20">Listing 8.12 ATLCONTROLWIN.H--m_BackColor Member Variable
			Added to the Class Declaration</A>
			<LI><A HREF="#Heading21">Listing 8.13 ATLCONTROLWIN.CPP--BackColor Property Source
			File Implementation</A>
			<LI><A HREF="#Heading22">Listing 8.14 ATLCONTROLWIN.H--Initialize the BackColor Property
			to an Initial Value</A>
			<LI><A HREF="#Heading23">Using Ambient Properties</A>
			<LI><A HREF="#Heading24">Creating Property Sheets</A>
			<LI><A HREF="#Heading25">Listing 8.15 ATLCONTROLWINPPG.H--Add the Necessary Include
			Files to the Property Page Header File</A>
			<LI><A HREF="#Heading26">Listing 8.16 ATLCONTROLWINPPG.H--Add the OnInitDialog Message
			Handler so the Property Page Can Be Initialized</A>
			<LI><A HREF="#Heading27">Listing 8.17 ATLCONTROLWINPPG.H--Modify the Apply Function
			to Update All of the Properties in the Control When the Property Page Exits</A>
			<LI><A HREF="#Heading28">Listing 8.18 ATLCONTROLWIN.H--Add the Property Page Reference
			to the </A><A HREF="#Heading29">Control Class Declaration to Complete the Property
			Page Implementation</A>
		</UL>
		<LI><A HREF="#Heading30">Adding Events</A>
		<UL>
			<LI><A HREF="#Heading31">Listing 8.19 ATLCONTROL.IDL--Add the Event Interface and
			the Change Method to the ATLControl.IDL File</A>
			<LI><A HREF="#Heading32">Listing 8.20 ATLCONTROLWIN.CPP--FireChange Helper Function
			Added to the Control</A>
			<LI><A HREF="#Heading33">Listing 8.21 ATLCONTROLWIN.CPP--FireChange Event Added to
			the CaptionMethod Implementation</A>
		</UL>
		<LI><A HREF="#Heading34">Persistence</A>
		<UL>
			<LI><A HREF="#Heading35">Listing 8.22 ATLCONTROLWIN.H--BackColor Property Added to
			the Property Map for Persistence</A>
		</UL>
		<LI><A HREF="#Heading36">Drawing the Control</A>
		<UL>
			<LI><A HREF="#Heading37">Standard Drawing</A>
			<LI><A HREF="#Heading38">Listing 8.23 ATLCONTROLWIN.H--Drawing Implementation Member
			Variables and Functions</A>
			<LI><A HREF="#Heading39">Listing 8.24 ATLCONTROLWIN.H--Initialize the New Member
			Variables in the Constructor</A>
			<LI><A HREF="#Heading40">Listing 8.25 ATLCONTROLWIN.CPP--Drawing Helper Functions</A>
			<LI><A HREF="#Heading41">Listing 8.26 ATLCONTROLWIN.CPP--Standard Drawing Added to
			the OnDraw Function</A>
		</UL>
		<LI><A HREF="#Heading42">From Here...</A>
	</UL>
</UL>

<P>
<HR SIZE="4">

<H1><A NAME="Heading1"></A>Using ATL to Create a Basic ActiveX Control</H1>

<UL>
	<LI><B>Registration</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 ATL's support of registration scripts makes registration support even easier to
	implement and use.
	<P>
	<LI><B>Adding methods</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 The ATL Object Wizards, while a little rudimentary, provide the necessary IDE integration
	that makes ATL appealing for rapid development.
	<P>
	<LI><B>Adding properties</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 The ATL Object Wizard makes adding properties a snap.
	<P>
	<LI><B>Adding events</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 Unfortunately, event support is not as easy to implement as that of MFC, but this
	chapter sheds some light on the subject that should make it as easy as is possible.
	<P>
	<LI><B>Persistence</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 ATL persistence support makes up for events in terms of ease of implementation.
	<P>
	<LI><B>Drawing the control</B> 
<SPACER TYPE="VERTICAL" SIZE="2">
 ATL deviates very little from the norm when it comes to drawing the control and
	requires no special knowledge to implement.
</UL>

<P>With the coming of Visual C++ 5.0, the ActiveX Template Library (ATL) has matured
to the level necessary for a complete ActiveX development framework. The two releases
of ATL, versions 1.0 and 1.1, that came before VC++ 5.0 introduced ATL to the growing
ActiveX development community as an alternative to MFC. However, the first two versions
of ATL allowed only for the creation of ActiveX COM Objects and ActiveX Automation
Servers (no small feats in their own right). ATL version 2.1, the version that ships
with VC++ 5.0, now supports the creation of ActiveX Controls.</P>
<P>Versions 1.0 and 1.1 included an AppWizard for creating a basic ATL project. Version
2.1 includes a number of AppWizards that can be used to create various ActiveX components,
thus furthering ATL's capability to compete with MFC as a rapid development tool.</P>
<P>In this chapter, you will create an ActiveX control with all the basics: methods,
properties, events, persistence, and drawing. Also, in this chapter and <A HREF="ch09.htm">Chapter
9</A>, you will explore some of the more advanced features and lesser known aspects
of control development, such as methods with optional parameters, asynchronous properties,
Clipboard support, and optimized drawing, to name a few.
<H2><A NAME="Heading2"></A>Creating the Basic Control Project</H2>
<P>To create an ATL ActiveX control, you want to take advantage of the AppWizard
provided by Visual C++. Run the Visual C++ development environment, and from the
<U>F</U>ile menu, select <U>N</U>ew. When the New dialog displays, select the Projects
tab (see fig 8.1). 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 ATLControl,
and the Lo<U>c</U>ation will be C:\que\ActiveX\ATLControl. Click the OK button to
start the ATL COM AppWizard so you can further define the properties of your control.
<B><BR>
<BR>
</B><A HREF="Art/08/gfigs01.jpg"><B>FIG. 8.1</B></A> <I><BR>
Define the new ATL control project with the New dialog.</I></P>
<P>The next step in the AppWizard is defining the basic architecture of your ATL
project (see fig. 8.2). Since you are creating an ActiveX Control, you choose the
<U>D</U>ynamic Link Library (DLL) radio button. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs02.jpg"><B>FIG. 8.2</B></A> <I><BR>
Define the basic architecture of the ATL COM Object with the ATL COM AppWizard.An
OCX is in reality nothing more than a DLL. The extension OCX was carried over from
the early days of control development. You have the option of changing the extension
from DLL to OCX.</I></P>
<P>Since the sample implementation will be a control, it is not necessary to support
merging of the proxy/stub marshaling code, nor will the implementation require the
use of MFC. Click the <U>F</U>inish button to continue.</P>
<P>The New Project Information dialog is used to confirm the settings that were selected
for the project prior to the creation of the actual source files (see fig. 8.3).
This step is the last one in the ATL COM AppWizard. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs03.jpg"><B>FIG. 8.3</B></A> <BR>
<I>Confirm the new project settings with the New Project Information dialog.</I></P>
<P>&quot;But wait,&quot; you say, &quot;I haven't defined any of my control 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 Object Wizard, which allows much better control of the project
implementation versus MFC since the developer can add any number of ActiveX Controls,
Servers, or plain COM Objects after the basic project is created. After you confirm
your project settings, click the OK button to close the ATL COM AppWizard and create
the <TT>ATLControl</TT> project.</P>
<P>The next step is to add your control implementations to the project. From the
<U>I</U>nsert menu, select the New <U>A</U>TL Object menu item. Within the ATL Object
Wizard, select the Controls item in the left panel to display the types of control
components that can be added (see fig. 8.4). Your implementation will be a Full Control,
so select the Full Control icon. The other types of components that can be created
are a Microsoft Internet Explorer control that supports all of the necessary interfaces
to be hosted by the Internet Explorer Web browser and a Property Page component,
which you need if your control requires property page support. The Internet Explorer
control simply supports fewer interfaces than the Full Control. The Full Control
will also work within a Web browser. For more information, see the ATL documentation.
Click the <U>N</U>ext button to continue. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs04.jpg"><B>FIG. 8.4</B></A> <BR>
<I>Select the type of ATL object to add to your project.</I></P>
<P>The next dialog is the ATL Object Wizard Properties dialog, which is used to define
the specific properties of the new object that will be added to your project. Select
the Names tab, and in the <U>S</U>hort Name edit field, type ATLControlWin (see fig.
8.5). The remainder of the edit fields will automatically update, reflecting the
short name that you added. The other fields can be changed, but in this case, you
use the default values. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs05.jpg"><B>FIG. 8.5</B></A><BR>
<I>Define the name of the new control object.</I></P>
<P>Select the Attributes tab so that you can define the attributes of the control
project (see fig. 8.6). Check the Support ISupportErrorInfo and Support Connection
Points check boxes to add OLE rich error support and events to the control. See <A
HREF="ch04.htm">Chapter 4</A> and the ATL documentation for more information regarding
the options available to you. Leave the remainder of the settings at their default
values. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs06.jpg"><B>FIG. 8.6</B></A> <I><BR>
Define the attributes of the new control object.</I></P>
<P>You use the Miscellaneous tab to define how the control will draw and act while
contained and whether your control implementation subclasses a built-in Windows control
(see fig. 8.7). For your implementation, you want the control to always create a
window whether or not the container is capable of supporting windowless controls,
so check the <U>W</U>indowed Only check box. Leave the remainder of the controls
at their default settings. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs07.jpg"><B>FIG. 8.7</B></A> <BR>
<I>The Miscellaneous tab is used to define some of the basic control behaviors.</I></P>
<P>The Stock Properties tab is used to define any number of the basic stock properties
that the control project will support (see fig. 8.8). For now, leave the Stock Properties
tab as is, and click the OK button to create the new control object. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs08.jpg"><B>FIG. 8.8</B></A> <I><BR>
The Stock Properties tab is used to define the stock properties that the control
object will be created with.</I></P>
<P>As with the MFC and later the BaseCtl implementation, you need to define two more
controls to complete the sample implementation. From the <U>I</U>nsert menu, select

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产91久久久久久久妲己| 亚洲观看高清完整版在线观看| 亚洲精品日韩一| 肉色丝袜一区二区| 99国产精品国产精品久久| 欧美一卡二卡三卡| 一个色在线综合| 国产毛片精品视频| 91精品国产欧美一区二区18| 亚洲欧美成人一区二区三区| 国产在线看一区| 91精品国产手机| 亚洲成人综合网站| 99国产精品久久久久久久久久久| 日韩精品中文字幕在线不卡尤物| 亚洲精品视频一区| gogogo免费视频观看亚洲一| 欧美tk—视频vk| 日韩av一级片| 91精品国产入口| 午夜精品在线看| 精品视频一区二区不卡| 亚洲乱码精品一二三四区日韩在线| 国产乱子轮精品视频| 欧美一区二区精美| 免费在线视频一区| 制服丝袜亚洲色图| 日本视频中文字幕一区二区三区| 欧亚洲嫩模精品一区三区| 中文字幕一区二区三区蜜月 | 成人精品亚洲人成在线| 久久久久高清精品| 国产a区久久久| 欧美国产视频在线| 不卡视频一二三四| 亚洲品质自拍视频网站| 91麻豆精品视频| 夜夜精品浪潮av一区二区三区| 99国产麻豆精品| 亚洲一区二区偷拍精品| 欧美日韩中文字幕一区二区| 亚洲亚洲精品在线观看| 欧美精品 国产精品| 蜜桃视频在线观看一区二区| 精品乱人伦小说| 成人av资源下载| 亚洲一区免费观看| 欧美一卡二卡三卡四卡| 国产精品一区在线观看乱码| 中文字幕精品一区二区三区精品| 99天天综合性| 亚洲成人手机在线| 亚洲精品一区在线观看| 成人免费视频一区二区| 夜夜嗨av一区二区三区网页| 欧美日韩国产大片| 精品影视av免费| 国产精品高清亚洲| 欧美丝袜自拍制服另类| 久久精品国产一区二区三区免费看| 欧美精品一区二| 色综合久久88色综合天天免费| 一级日本不卡的影视| 精品卡一卡二卡三卡四在线| 国产91在线观看| 亚洲一区二区欧美| 亚洲精品一区二区在线观看| 91色porny蝌蚪| 久久精品国产在热久久| 亚洲毛片av在线| 日韩一级二级三级精品视频| 99视频精品在线| 日本网站在线观看一区二区三区 | 91麻豆精品国产无毒不卡在线观看 | 97aⅴ精品视频一二三区| 五月婷婷激情综合网| 国产三级欧美三级日产三级99| 成人国产精品免费观看视频| 亚洲大片一区二区三区| 国产精品久久综合| 欧美一级欧美一级在线播放| 成人精品视频网站| 日韩av一区二区三区| 亚洲视频香蕉人妖| 日韩欧美高清dvd碟片| 91天堂素人约啪| 九色porny丨国产精品| 亚洲资源在线观看| 久久亚洲捆绑美女| 在线播放欧美女士性生活| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 亚洲激情五月婷婷| 久久久久久99久久久精品网站| 91国产福利在线| 成人高清视频在线| 国产呦萝稀缺另类资源| 天天综合天天做天天综合| 国产精品国产自产拍高清av| 精品国产乱码久久久久久久久| 欧美在线短视频| 99re成人在线| 高清在线不卡av| 精品一区二区三区在线观看国产| 亚洲一区二区在线观看视频| 一区免费观看视频| 欧美极品美女视频| 久久久久久电影| 精品日韩一区二区三区| 51精品久久久久久久蜜臀| 精品视频123区在线观看| 色婷婷一区二区三区四区| www.亚洲色图.com| 成人美女视频在线看| 岛国精品在线观看| 国产精品1024久久| 国产电影一区在线| 国产999精品久久久久久绿帽| 国产伦精品一区二区三区免费| 久久99国产精品尤物| 久久精品国产精品青草| 老司机免费视频一区二区三区| 另类欧美日韩国产在线| 蜜桃av一区二区三区| 久久99久久99| 国产综合久久久久久鬼色| 国模冰冰炮一区二区| 国产不卡视频在线观看| 成人国产一区二区三区精品| 91免费观看国产| 91福利视频久久久久| 欧美美女喷水视频| 欧美一区二区在线看| 欧美精品一区二区不卡| 亚洲国产成人自拍| 亚洲欧美一区二区三区孕妇| 伊人婷婷欧美激情| 日韩国产精品久久久久久亚洲| 三级一区在线视频先锋| 久久国产精品第一页| 高清国产一区二区| 91麻豆福利精品推荐| 欧美美女一区二区在线观看| 日韩美女视频在线| 国产精品久久久久久亚洲伦| 亚洲一级二级三级在线免费观看| 丝袜美腿亚洲一区| 国模少妇一区二区三区| 日本韩国精品一区二区在线观看| 欧美日韩高清一区二区不卡| www日韩大片| 亚洲综合av网| 国内精品久久久久影院薰衣草| 国产精品69久久久久水密桃| 色香蕉成人二区免费| 日韩精品中文字幕一区二区三区 | 欧美videossexotv100| 国产精品久久久久影院亚瑟| 亚洲成人激情自拍| 国产一区二区精品久久99| 色综合久久综合网欧美综合网| 6080yy午夜一二三区久久| 国产日韩欧美一区二区三区乱码 | 欧美高清激情brazzers| 国产午夜精品一区二区三区四区| 亚洲精选视频免费看| 国内精品久久久久影院一蜜桃| 日本韩国欧美在线| 日本一区二区不卡视频| 视频一区在线播放| 99re热视频精品| 久久久久久久久久久黄色| 日韩精品电影在线| 91视频一区二区三区| 久久综合99re88久久爱| 午夜av一区二区| 色综合网站在线| 中文字幕久久午夜不卡| 久久精品999| 欧美日韩国产三级| 亚洲免费av在线| 成人高清视频免费观看| 欧美精品一区二区三区高清aⅴ | 88在线观看91蜜桃国自产| 日韩美女视频一区| 懂色av一区二区三区免费观看| 欧美一区二区视频观看视频| 一区二区在线电影| 97se亚洲国产综合自在线观| 国产亚洲欧洲一区高清在线观看| 美腿丝袜亚洲色图| 日韩午夜在线影院| 日韩av成人高清| 欧美一卡在线观看| 日韩成人一区二区三区在线观看| 色婷婷av一区二区三区软件| 亚洲女人小视频在线观看| av一区二区三区| 日本一区二区三区在线观看| 国产在线播精品第三| 久久久久综合网|