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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ch09.htm

?? 用VC開發(fā)ACTIVEX書籍和隨書源碼
?? HTM
?? 第 1 頁 / 共 5 頁
字號:

<P>Add the initialization of the <TT>m_lReadyState</TT> member variable to the constructor
of the <TT>CATLControlWin</TT> class (see Listing 9.3).
<H3><A NAME="Heading6"></A>Listing 9.3 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.H--Initialize
the m_lReadyState Member Variable in the Class Constructor</H3>
<P><FONT COLOR="#0066FF"><TT>CATLControlWin() <BR>
{ <BR>
. . . <BR>
// set the initial state of the ReadyState property <BR>
m_lReadyState = READYSTATE_LOADING; <BR>
} </TT></FONT></P>

<P>The last step to implement is the <TT>get_ReadyState</TT> function, which simply
returns the current value of the <TT>m_lReadyState</TT> member variable (see Listing
9.4).
<H3><A NAME="Heading7"></A>Listing 9.4 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.CPP--Implement
the get_ReadyState Function to Return the Current ReadyState Value</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::get_ReadyState(long * pVal)
<BR>
{ <BR>
// set the return value to the value of the member variable <BR>
*pVal = m_lReadyState; <BR>
return S_OK; <BR>
} </TT></FONT></P>

<P>The next step is to add support for the <TT>ReadyStateChange</TT> event. Open
the ATLControl.idl file, and add the <TT>ReadyStateChange</TT> function to the event
interface that is added in <A HREF="ch08.htm">Chapter 8</A> (see Listing 9.5).
<H3><A NAME="Heading8"></A>Listing 9.5<SPACER TYPE="HORIZONTAL" SIZE="10"> ATLCONTROL.IDL--Add
the ReadyStateChange Event to the IDL File</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
[ <BR>
uuid(C31D4C71-7AD7-11d0-BEF6-00400538977D), <BR>
helpstring(&quot;ATLControlWin Event Interface&quot;) <BR>
] <BR>
dispinterface _DATLControlWin <BR>
{ <BR>
properties: <BR>
methods: <BR>
[id(1)] void Change([in, out]BSTR * bstrCaption, <BR>
[in, out] long * lAlignment); <BR>
[id(DISPID_READYSTATECHANGE)] void ReadyStateChange(); <BR>
}; <BR>
<BR>
. . . </TT></FONT></P>

<P>Remember that support for events is not automatic in ATL, so you must manually
rebuild the CPATLControl.h file that was created in <A HREF="ch08.htm">Chapter 8</A>
for your connection point support by using the ATL Proxy Generator. To update the
file follow these steps:

<OL>
	<LI>Compile the IDL file since the event interface header file is built from the
	type library.
	<P>
	<LI>From the Project menu, select the Add to Project menu item, and then select the
	Components and Controls submenu item.
	<P>
	<LI>In the Components and Controls Gallery dialog, double-click the Developer Studio
	Components folder.
	<P>
	<LI>After the Components and Controls Gallery dialog is refreshed with data, double-click
	the ATL Proxy Generator icon.
	<P>
	<LI>Click OK to close the Insert the ProxyGen Component dialog.
	<P>
	<LI>Click the ... button to display the Open dialog. Select the ATLControl.tlb file,
	and click Open.
	<P>
	<LI>Select the <TT>_DATLControlWin</TT> entry in the <U>N</U>ot Selected list box,
	and click the &gt; button to move the entry to the <U>S</U>elected list box. Ensure
	that the Proxy <U>T</U>ype is set to Connection Point and click <U>I</U>nsert.
	<P>
	<LI>A Save dialog appears with the file CPATLControl.h in the File <U>n</U>ame edit
	box. Click <U>S</U>ave to continue. Click Yes to replace the existing CPATLControl.h
	file.
	<P>
	<LI>Click OK in the confirmation dialog that indicates the operation was successful.
	<P>
	<LI>Click Close in the ATL Proxy Generator and Components and Controls Gallery dialogs.
</OL>

<P>The <TT>Fire_ReadyStateChange</TT> method is now added to the <TT>CProxy_DATLControlWin</TT>
class.</P>
<P>Asynchronous properties are based on URLs and not on the data type of the data
to be downloaded, for example, a bitmap or text file. The URL is stored in a string
property of the control. For the sample implementation, you add the property called
<TT>TextDataPath</TT> to the control. From the ClassView tab in the Project Workspace
window, select the <TT>IATLControlWin</TT> interface, click the right mouse button,
and select the Add <U>P</U>roperty... menu item.</P>
<P>In the Add Property to Interface dialog, set the Property <U>T</U>ype to BSTR,
the Property <U>N</U>ame to <TT>TextDataPath</TT>, and leave the remainder of the
settings at their default values (see fig. 9.2). Click OK to confirm the entry and
close the dialog. <B><BR>
<BR>
</B><A HREF="Art/09/xfigs02.jpg"><B>FIG. 9.2</B></A> <I><BR>
Add the <TT>TextDataPath </TT>property to the control using the ATL ClassWizard.</I></P>
<P>Add the <TT>dispidTextDataPath</TT> constant to the <TT>PROPDISPIDS</TT> enumeration
in the ATLControl.idl file, and update the <TT>TextDataPath</TT> function to use
the constant value (see Listing 9.6).
<H3><A NAME="Heading9"></A>Listing 9.6 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROL.IDL--Add
the dispidTextDataPath Enumeration to the IDL File</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
typedef enum propdispids <BR>
{ <BR>
dispidAlignment = 2, <BR>
dispidCaptionProp = 3, <BR>
dispidTextDataPath = 4, <BR>
}PROPDISPIDS; <BR>
[ <BR>
object, <BR>
uuid(A19F6963-7884-11D0-BEF3-00400538977D), <BR>
dual, <BR>
helpstring(&quot;IATLControlWin Interface&quot;), <BR>
pointer_default(unique) <BR>
] <BR>
interface IATLControlWin : IDispatch <BR>
{ <BR>
[id(1), helpstring(&quot;method CaptionMethod&quot;)] HRESULT CaptionMethod( <BR>
[in] BSTR bstrCaption, [in, optional] VARIANT varAlignment, <BR>
[out, retval] long * lRetVal); <BR>
[propget, id(dispidTextDataPath), helpstring(&quot;property TextDataPath&quot;)]
<BR>
HRESULT TextDataPath([out, retval] BSTR *pVal); <BR>
[propput, id(dispidTextDataPath), helpstring(&quot;property TextDataPath&quot;)]
<BR>
HRESULT TextDataPath([in] BSTR newVal); <BR>
. . . </TT></FONT></P>

<P>The TextDataPath property is used to store the URL of the data that the property
represents. To complete your implementation of the property, add the member variable,
<TT>m_bstrTextDataPath</TT> (see Listing 9.7). The data for the member is declared
as the type <TT>CComBSTR</TT>, which is a <TT>BSTR</TT> wrapper class provided with
ATL. See the ATL documentation for more information. The use of the <TT>CComBSTR</TT>
data type versus a standard <TT>BSTR</TT> or <TT>LPTSTR</TT> is purely an arbitrary
decision on your part and is based on your implementation requirements. We used <TT>CComBSTR</TT>
to demonstrate the different implementation styles available to you with ATL. You
also add the member variable <TT>m_bstrText</TT>, also of the type <TT>CComBSTR</TT>,
to store the data as it is supplied to the control and the member function OnData,
which will be the callback function that receives the data as it is downloaded. We
will discuss these two members a little later in this chapter.
<H3><A NAME="Heading10"></A>Listing 9.7<SPACER TYPE="HORIZONTAL" SIZE="10"> ATLCONTROLWIN.H--The
m_bstrTextDataPath Member Variable Is Added to the Class Declaration to Store the
TextDataPath Property</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
//OnData will be used as a callback functin by the CBindStatusCallback object. <BR>
//OnData will be called periodically with data from the asynchronous transfer <BR>
void OnData(CBindStatusCallback&lt;CATLControlWin&gt;* pbsc, BYTE* pBytes, DWORD
dwSize); <BR>
protected: <BR>
. . . <BR>
// for the ReadyState property <BR>
long m_lReadyState; <BR>
// for the TextDataPath property <BR>
CComBSTR m_bstrTextDataPath; <BR>
// to hold the data as it is passed in <BR>
CComBSTR m_bstrText; <BR>
}; <BR>
#endif //__ATLCONTROLWIN_H_ </TT></FONT></P>
<P>The implementation of the <TT>get_TextDataPath/put_TextDataPath</TT> function
is where the asynchronous data transfer of the property takes place (see Listing
9.8). The <TT>get_TextDataPath</TT> function returns the current value stored in
the <TT>m_bstrTextDataPath</TT> member variable. The <TT>put_TextDataPath</TT> function
stores the new location of the data and then initiates a transfer of the data to
the control with a call to <TT>CBindStatusCallback&lt;CATLControlWin&gt;::Download
(. . .)</TT>. <TT>CBindStatusCallback</TT> is an ATL wrapper class that wraps the
<TT>IBindStatusCallback</TT> interface. <TT>CBindStatusCallback</TT> handles all
of the details of the data transfer and only requires that you implement a function,
in this case <TT>OnData</TT>, to receive the data as it is downloaded. The <TT>OnData</TT>
function is supplied as the second parameter to the <TT>Download</TT> function and
must conform to the prototype defined by ATL. See the ATL documentation on the <TT>Download</TT>
function for more information.
<H3><A NAME="Heading11"></A>Listing 9.8<SPACER TYPE="HORIZONTAL" SIZE="10"> ATLCONTROLWIN.CPP--Implementation
of the get_TextDataPath /put_TextDataPath Functions</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::get_TextDataPath(BSTR *
pVal) <BR>
{ <BR>
// return a copy of the member variable <BR>
*pVal = m_bstrTextDataPath.Copy(); <BR>
return S_OK; <BR>
} <BR>
STDMETHODIMP CATLControlWin::put_TextDataPath(BSTR newVal) <BR>
{ <BR>
HRESULT hResult = S_OK; <BR>
// copy the new string to the member variable <BR>
m_bstrTextDataPath = newVal; <BR>
// clear the data buffer <BR>
m_bstrText = _T(&quot;&quot;); <BR>
// start the asynchronous download of the data <BR>
CBindStatusCallback&lt;CATLControlWin&gt;::Download(this, OnData, m_bstrTextDataPath,
<BR>
m_spClientSite, FALSE); <BR>
// let the container know that the property has changed <BR>
this-&gt;SetDirty(TRUE); <BR>
// this-&gt;SetModifiedFlag(); &lt;== MFC version <BR>
return hResult; <BR>
} </TT></FONT></P>

<P><TT>OnData</TT> is a very basic implementation of the asynchronous data transfer
mechanism provided by the <TT>IBindStatusCallback</TT> interface and the <TT>CBindStatusCallback</TT>
class (see Listing 9.9). If the <TT>OnUData</TT> function is called, the new data
is appended to the <TT>m_bstrText</TT> member variable, and the <TT>CaptionMethod</TT>
is called. Throughout the <TT>OnData</TT> implementation, note the use of the <TT>CBindStatusCallback</TT>
members to determine the status of the current call to <TT>OnData</TT>. Also note
the use of the <TT>ReadyState</TT> property to indicate to the container application
that an asynchronous download is taking place and when it has finished. The BaseCtl
sample in <A HREF="ch10.htm">Chapters 10</A> and <A HREF="ch11.htm">11</A> demonstrates
how to implement asynchronous properties using the <TT>OnDataAvailable</TT> function.
<TT>OnDataAvailable</TT> gives you more information about the download of the data
and how it is taking place.
<H3><A NAME="Heading12"></A>Listing 9.9<SPACER TYPE="HORIZONTAL" SIZE="10"> ATLCONTROLWIN.CPP--OnData
Function Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>//OnData will be used as a callback functin by the CBindStatusCallback
object. <BR>
//OnData will be called periodically with data from the asynchronous transfer <BR>
void CATLControlWin::OnData(CBindStatusCallback&lt;CATLControlWin&gt;* pbsc, BYTE*
pBytes, <BR>
DWORD dwSize) <BR>
{ <BR>
// if we have not read any data yet <BR>
if(pbsc-&gt;m_dwTotalRead == 0) <BR>
{ <BR>
// clear the buffer <BR>
m_bstrText = _T(&quot;&quot;); <BR>
// set the ready state of the control <BR>
m_lReadyState = READYSTATE_LOADING; <BR>
// let the container know that the property has changed <BR>
this-&gt;Fire_ReadyStateChange(); <BR>
} <BR>
// add the data to our buffer <BR>
m_bstrText.Append((LPCSTR) pBytes); <BR>
long lRetVal; <BR>
VARIANT varAlignment; <BR>
// initialize the variant <BR>
::VariantInit(&amp;varAlignment); <BR>
<BR>
// defer to the CaptionMethod implementation <BR>
this-&gt;CaptionMethod(m_bstrText, varAlignment, &amp;lRetVal); <BR>
// if the function returned success <BR>
if(TRUE == lRetVal) <BR>
// let the control know that the property has changed <BR>
this-&gt;SetDirty(TRUE); <BR>
// this-&gt;SetModifiedFlag(); &lt;== MFC version <BR>
// if there is nothing left <BR>
if(pbsc-&gt;m_dwAvailableToRead == 0) <BR>
{ <BR>
// set the ready state of the control <BR>
m_lReadyState = READYSTATE_COMPLETE; <BR>
// let the container know that the property has changed <BR>
this-&gt;Fire_ReadyStateChange(); <BR>
} <BR>
} </TT></FONT></P>
<P>The final touch of your asynchronous property implementation is to add the property
to the persistence macro in your class declaration (see Listing 9.10). Do not add

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区免费在线观看| 久久亚洲一区二区三区四区| 亚洲免费观看高清完整| 粉嫩av一区二区三区在线播放 | 国产精品亚洲一区二区三区妖精 | 亚洲成人av资源| 91超碰这里只有精品国产| 婷婷中文字幕综合| 欧美一级理论片| 久久成人免费日本黄色| 久久精品在线观看| av亚洲精华国产精华| 亚洲人吸女人奶水| 欧美久久久久免费| 国产一区二区在线电影| 国产精品区一区二区三| 91久久久免费一区二区| 另类的小说在线视频另类成人小视频在线| 日韩一区二区麻豆国产| 国产91精品久久久久久久网曝门 | 国产精品免费视频网站| 色94色欧美sute亚洲13| 免费在线看一区| 国产精品萝li| 在线成人av网站| 国产精品一线二线三线精华| 亚洲精品va在线观看| 日韩亚洲欧美成人一区| 成人午夜在线播放| 香蕉成人啪国产精品视频综合网 | 99国产精品久久久久久久久久久 | 色老汉一区二区三区| 免费成人在线网站| 自拍视频在线观看一区二区| 欧美妇女性影城| 粉嫩av一区二区三区在线播放 | 亚洲精品乱码久久久久久日本蜜臀| 欧美综合亚洲图片综合区| 久久精品噜噜噜成人av农村| 中文字幕在线观看一区| 欧美综合天天夜夜久久| 国产精品原创巨作av| 亚洲成人一二三| 国产精品大尺度| 欧美精品久久久久久久多人混战 | 欧美高清在线一区二区| 欧美老年两性高潮| 一本色道综合亚洲| 国产精品一区二区三区四区| 日韩精品一二三四| 亚洲猫色日本管| 国产日韩欧美不卡| 日韩一区二区三免费高清| 日本大香伊一区二区三区| 丁香一区二区三区| 免费一级片91| 午夜精品福利一区二区三区蜜桃| 国产精品区一区二区三| 精品久久久三级丝袜| 欧美日韩中文国产| 一本一道波多野结衣一区二区| 国产精品456露脸| 麻豆国产欧美一区二区三区| 一区二区三区不卡视频| 亚洲视频综合在线| 亚洲欧洲精品一区二区精品久久久| 精品国产成人系列| 精品国产三级电影在线观看| 欧美一级精品在线| 日韩欧美电影一二三| 91精品在线一区二区| 91精品麻豆日日躁夜夜躁| 欧美在线观看一二区| 色综合久久综合网| 91丨九色丨蝌蚪丨老版| 成人福利视频在线看| 国产乱码精品1区2区3区| 精品在线你懂的| 久草热8精品视频在线观看| 蜜臀va亚洲va欧美va天堂| 免费不卡在线观看| 久久er99精品| 久久久久久久久久久久久夜| 欧美午夜一区二区三区| av一区二区三区四区| 狠狠色丁香久久婷婷综| 精品一区二区三区不卡| 久草热8精品视频在线观看| 国产在线一区观看| 盗摄精品av一区二区三区| 丁香婷婷综合激情五月色| 成人av影院在线| 91视频.com| 欧美精品 日韩| 精品国产3级a| 国产精品电影一区二区| 亚洲一区二区精品视频| 视频在线观看一区二区三区| 久久丁香综合五月国产三级网站| 九九视频精品免费| 成人av高清在线| 在线精品视频小说1| 日韩一区二区三区视频在线| 久久婷婷国产综合国色天香| 国产精品日产欧美久久久久| 一区二区三区高清在线| 麻豆成人久久精品二区三区小说| 国产主播一区二区| 91免费看视频| 91精品国产综合久久久久久久| 欧美精品一区二区三区高清aⅴ| 欧美经典三级视频一区二区三区| 亚洲男人的天堂在线观看| 日韩在线一区二区| 成熟亚洲日本毛茸茸凸凹| 色8久久精品久久久久久蜜| 538在线一区二区精品国产| 2017欧美狠狠色| 亚洲欧美另类久久久精品| 男男成人高潮片免费网站| 99久久精品国产精品久久| 欧美性大战久久久| 久久精品亚洲国产奇米99| 亚洲综合免费观看高清完整版| 精品一区二区三区在线观看国产| 99这里都是精品| 日韩精品一区二区三区swag| 中文字幕在线不卡一区| 麻豆传媒一区二区三区| 91美女片黄在线观看91美女| 日韩亚洲欧美在线观看| 亚洲美女视频在线| 国产剧情一区二区| 91精品国产手机| 17c精品麻豆一区二区免费| 美国十次综合导航| 一本色道久久综合亚洲aⅴ蜜桃| 精品国产在天天线2019| 亚洲国产sm捆绑调教视频| 成人国产精品免费网站| 精品国产污网站| 蜜桃视频一区二区三区| 欧美丝袜自拍制服另类| 亚洲人成亚洲人成在线观看图片| 国产一区二区不卡老阿姨| 91精品国产丝袜白色高跟鞋| 亚洲午夜久久久久久久久电影院| 国产91露脸合集magnet| 精品久久久影院| 麻豆精品久久久| 欧美一级搡bbbb搡bbbb| 亚洲国产一区二区a毛片| 99在线热播精品免费| 国产精品无圣光一区二区| 国产伦理精品不卡| 精品美女一区二区| 精品一区二区三区在线播放 | 色综合婷婷久久| 国产精品欧美一区二区三区| 国产成人亚洲精品青草天美| 精品日韩一区二区三区免费视频| 日本成人在线网站| 4438x成人网最大色成网站| 亚洲电影中文字幕在线观看| 色综合久久久久综合| 亚洲日韩欧美一区二区在线| 播五月开心婷婷综合| 最新国产成人在线观看| 972aa.com艺术欧美| 亚洲欧美日韩电影| 欧洲视频一区二区| 日韩vs国产vs欧美| 日韩久久久精品| 国产在线播放一区| 久久久天堂av| 国产另类ts人妖一区二区| 国产精品视频第一区| 97精品电影院| 有坂深雪av一区二区精品| 欧美伊人久久大香线蕉综合69 | 欧美videos大乳护士334| 韩国成人在线视频| 亚洲国产精品v| 99久久伊人精品| 有码一区二区三区| 7777精品伊人久久久大香线蕉超级流畅| 亚洲国产欧美日韩另类综合 | 亚洲青青青在线视频| 欧洲另类一二三四区| 美女在线一区二区| 中文字幕欧美日韩一区| 一本色道久久综合亚洲aⅴ蜜桃| 午夜精品视频在线观看| 日韩欧美国产一区在线观看| 国产成人免费在线观看不卡| 亚洲激情在线激情| 日韩欧美一区二区三区在线| 国产成人综合自拍| 亚洲午夜激情网页| 久久蜜桃av一区二区天堂|