亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲18色成人| 日韩影院精彩在线| 久久精品一区二区| 久久婷婷综合激情| 日韩一区二区三区视频在线观看| 欧美在线观看一区| 在线观看日韩高清av| 欧美最新大片在线看| 欧美日韩午夜在线视频| 欧美三级资源在线| 91.麻豆视频| 日韩欧美www| 久久久精品免费免费| 久久久久久电影| 国产精品传媒入口麻豆| 亚洲精选免费视频| 日韩高清一区在线| 国产精品综合一区二区三区| 东方欧美亚洲色图在线| 色综合天天综合给合国产| 欧美伊人精品成人久久综合97 | 国产一区二区主播在线| 精品一区二区三区影院在线午夜| 国产一区二区h| voyeur盗摄精品| 国产日产欧美一区二区三区| 中文字幕一区不卡| 日韩国产精品久久久| 国产在线麻豆精品观看| 9i在线看片成人免费| 欧美肥妇毛茸茸| 国产欧美一区二区三区网站 | 欧美狂野另类xxxxoooo| 337p粉嫩大胆色噜噜噜噜亚洲| 国产午夜久久久久| 亚洲国产日韩一区二区| 国产精品资源站在线| 欧美午夜宅男影院| 欧美国产精品v| 日日噜噜夜夜狠狠视频欧美人| 国产河南妇女毛片精品久久久| 91国产免费看| 久久久另类综合| 五月婷婷激情综合| 粉嫩aⅴ一区二区三区四区五区| 91黄视频在线观看| 国产欧美日韩麻豆91| 欧美aaaaaa午夜精品| 91久久精品一区二区| 久久午夜羞羞影院免费观看| 五月婷婷综合在线| 91美女在线看| 国产精品久久免费看| 国产一区欧美一区| 欧美喷水一区二区| 亚洲美女区一区| 成人免费av资源| 欧美一区二区播放| 不卡电影一区二区三区| 亚洲精品一区二区精华| 图片区小说区区亚洲影院| 岛国一区二区在线观看| 久久精品一区蜜桃臀影院| 亚洲va在线va天堂| 欧美自拍丝袜亚洲| 亚洲欧洲日本在线| 99久久精品费精品国产一区二区| 久久毛片高清国产| 国产一区三区三区| 精品成人一区二区三区| 全国精品久久少妇| 欧美日韩一区二区欧美激情| 亚洲综合小说图片| 97久久久精品综合88久久| 中文字幕亚洲欧美在线不卡| 成人精品国产一区二区4080| 中文乱码免费一区二区| 成人小视频免费在线观看| 久久午夜电影网| 国产精品一品二品| 欧美激情一二三区| 99在线视频精品| 亚洲欧洲中文日韩久久av乱码| 99热这里都是精品| 一区二区三区色| 欧美性色aⅴ视频一区日韩精品| 一区二区在线电影| 欧美日韩精品福利| 久久精品72免费观看| 精品国产露脸精彩对白| 国产99久久久精品| 中文字幕一区二区在线播放| 色综合天天做天天爱| 洋洋成人永久网站入口| 欧美日韩国产小视频在线观看| 色综合久久88色综合天天| 亚洲影院免费观看| 欧美一级高清大全免费观看| 精品综合免费视频观看| 久久精品亚洲精品国产欧美| 91在线看国产| 亚洲成人免费影院| 精品国产一区二区三区久久久蜜月| 国产激情一区二区三区| 最近中文字幕一区二区三区| 欧美狂野另类xxxxoooo| 国产福利一区在线| 一区二区三区久久久| 日韩一区二区免费在线电影| 国产一区二区三区国产| 亚洲理论在线观看| 精品国产伦一区二区三区免费| 成人午夜看片网址| 五月婷婷久久丁香| 国产精品毛片久久久久久| 91精品国产综合久久福利软件| 国产精品一线二线三线| 伊人开心综合网| 久久久不卡影院| 欧美三级电影在线观看| 大胆欧美人体老妇| 秋霞电影网一区二区| 中文字幕视频一区二区三区久| 3atv一区二区三区| 在线影院国内精品| 国产成人夜色高潮福利影视| 亚洲 欧美综合在线网络| 亚洲国产精品成人久久综合一区| 欧美丰满一区二区免费视频| 91在线无精精品入口| 久久99精品国产91久久来源| 天天免费综合色| 亚洲欧美乱综合| 欧美激情综合在线| 日韩亚洲欧美高清| 欧美日韩专区在线| 色综合天天综合在线视频| 国产在线精品一区二区夜色| 亚洲图片欧美色图| 亚洲视频一二三区| 欧美国产禁国产网站cc| 久久免费偷拍视频| 日韩一区二区精品| 91精品国产91久久综合桃花| 欧美主播一区二区三区美女| voyeur盗摄精品| 高清在线观看日韩| 国产成人在线电影| 国产乱码字幕精品高清av| 免费美女久久99| 亚洲福利一区二区| 亚洲自拍偷拍网站| 一区二区三区四区视频精品免费 | 免费看日韩a级影片| 视频一区欧美日韩| 日韩在线一二三区| 亚洲成人自拍偷拍| 午夜免费久久看| 日韩中文欧美在线| 六月丁香婷婷久久| 国产一区二区影院| 国产精品99久| 丰满放荡岳乱妇91ww| 99久久久久久| 在线观看91精品国产入口| 欧美日韩一区二区在线视频| 欧美老女人第四色| 日韩美女在线视频| 久久久精品综合| 国产精品久久久久久妇女6080| 亚洲欧美在线aaa| 亚洲在线一区二区三区| 日韩av电影免费观看高清完整版 | 亚洲福利视频一区| 日韩高清不卡一区二区三区| 麻豆一区二区三| 国产成人免费视频网站| 91视频在线观看| 在线不卡a资源高清| 久久久影视传媒| 亚洲美女屁股眼交| 色久综合一二码| 欧美一区二区三区日韩视频| 日韩女优电影在线观看| 中日韩av电影| 日日摸夜夜添夜夜添国产精品| 国产中文字幕精品| 日本丶国产丶欧美色综合| 日韩一区二区电影网| 国产精品久久看| 日韩精品乱码av一区二区| 国产成人av一区二区三区在线| 色综合久久天天综合网| 91精品国产麻豆国产自产在线 | 最新欧美精品一区二区三区| 一区二区三区四区精品在线视频 | 欧美精彩视频一区二区三区| 婷婷开心激情综合| 波多野结衣91| 精品成人在线观看|