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

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

?? ch08.htm

?? 用VC開發(fā)ACTIVEX書籍和隨書源碼
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
in the <TT>m_lAlignment</TT> member variable. The function then calls the <TT>SetDirty</TT>
and the <TT>FireOnChanged</TT> functions--note the MFC equivalent functions still
in the code--to notify the control and the container, respectively, that the value
of the property has changed. <TT>FireOnChanged</TT> has the effect of forcing the
container to refresh its property browser to reflect the new value. This step is
very important because the value of the property could change without the container's
knowledge, either through the control's property sheet or, in some cases, in response
to another function call.</P>
<P>You might be asking &quot;Why didn't I add <TT>FireOnChanged</TT> to the <TT>CaptionMethod</TT>?&quot;
Well, you could have, but it wouldn't do much because the <TT>CaptionMethod</TT>
can never be executed while the control is in design mode, which is the purpose of
<TT>FireOnChanged</TT>. The <TT>FireOnChanged</TT> function is where you make use
of the dispid constants that were defined earlier.</P>
<P>The last thing the <TT>SetAlignment</TT> method does is to invalidate the control's
UI so it will repaint using the new information.
<H3><A NAME="Heading13"></A>Listing 8.7 ATLCONTROLWIN.CPP--Alignment Property Get/Put
Method Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::get_Alignment(long * pVal)
<BR>
{ <BR>
HRESULT hResult = S_OK; <BR>
// return our current setting <BR>
*pVal = m_lAlignment; <BR>
return hResult; <BR>
} <BR>
STDMETHODIMP CATLControlWin::put_Alignment(long newVal) <BR>
{ <BR>
HRESULT hResult = S_OK; <BR>
// if we are in the valid range for the property <BR>
if(newVal &gt;= EALIGN_LEFT &amp;&amp; newVal &lt;= EALIGN_RIGHT) <BR>
{ <BR>
// set the new property value <BR>
m_lAlignment = newVal; <BR>
// let the control know that the property has changed <BR>
this-&gt;SetDirty(TRUE); <BR>
// this-&gt;SetModifiedFlag(); &lt;== MFC version <BR>
// refresh the property browser <BR>
this-&gt;FireOnChanged(dispidAlignment); <BR>
// this-&gt;BoundPropertyChanged(dispidAlignment); &lt;== MFC Version <BR>
// force the control to repaint itself <BR>
this-&gt;FireViewChange(); <BR>
// this-&gt;InvalidateControl(); &lt;== MFC Version <BR>
} <BR>
return hResult; <BR>
} </TT></FONT></P>
<H3><A NAME="Heading14"></A>Creating Parameterized User Defined Properties</H3>
<P>A <I>parameterized property</I> is a property that, in addition to being of a
specific type (for example, <TT>BSTR</TT> or <TT>long</TT>), accepts one or more
additional parameters to further define the data of the property. Parameterized properties
can be useful for properties that represent collections of data where the additional
parameter is the index into the collection.</P>
<P>You are going to expose the control's <TT>m_lptstrCaption</TT> member variable
as a parameterized property in addition to your <TT>CaptionMethod</TT> function.</P>
<P>Parameterized properties are added in the same manner as normal properties. 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 <TT>BSTR</TT>
and the Property <U>N</U>ame to <TT>CaptionProp</TT>, add the Para<U>m</U>eters string
<TT>[in, optional] VARIANT varAlignment</TT>, and leave the remainder of the settings
at their default values (see fig. 8.13). Click OK to confirm the entry and close
the dialog. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs13.jpg"><B>FIG. 8.13</B></A><B> </B><I><BR>
Define the <TT>Caption</TT> property <TT>propget</TT> function attributes.</I></P>
<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>NOTE:</B> Even though the <TT>VARIANT</TT> <TT>varAlignment</TT> is defined
	as <TT>[optional]</TT> for both the <TT>get_CaptionProp</TT> and <TT>put_CaptionProp</TT>
	functions, only the <TT>get_CaptionProp</TT> implementation is truly optional. The
	parameter was added in this fashion because it is impossible to use the ATL ClassWizard
	to generate two separate functions each having the same name and ID. The <TT>[optional]</TT>
	attribute can be removed from the <TT>put_CaptionProp</TT> function if you want without
	adverse effect on the implementation.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>
<P>As with the normal user defined parameter, you add a constant, <TT>dispidCaptionProp</TT>,
to the IDL file (see Listing 8.8) that represents the dispid of the property. You
also need to replace the <TT>id</TT> of the property with the newly added constant
<TT>dispidCaptionProp</TT>.
<H3><A NAME="Heading15"></A>Listing 8.8 ATLCONTROL.IDL--Update the IDL File to Support
the Parameterized Property</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
typedef enum propdispids <BR>
{ <BR>
dispidAlignment = 2, <BR>
dispidCaptionProp = 3, <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;)] <BR>
HRESULT CaptionMethod([in] BSTR bstrCaption, <BR>
[in, optional] VARIANT varAlignment, [out, retval] long * lRetVal); <BR>
[propget, id(dispidCaptionProp), helpstring(&quot;property CaptionProp&quot;)] <BR>
HRESULT CaptionProp([in, optional] VARIANT varAlignment, <BR>
[out, retval] BSTR *pVal); <BR>
[propput, id(dispidCaptionProp), helpstring(&quot;property CaptionProp&quot;)] <BR>
HRESULT CaptionProp([in] VARIANT varAlignment, [in] BSTR newVal); <BR>
[propget, id(dispidAlignment), helpstring(&quot;property Alignment&quot;)] <BR>
HRESULT Alignment([out, retval] long *pVal); <BR>
[propput, id(dispidAlignment), helpstring(&quot;property Alignment&quot;)] <BR>
HRESULT Alignment([in] long newVal); <BR>
}; <BR>
. . . </TT></FONT></P>
<P>The method <TT>get_CaptionProp</TT> is called to return data from the property.
In your implementation, you are going to ignore the alignment parameter because it
is of no use to you in this context; you simply return the caption (see Listing 8.9).
You need to make sure that the string variable, <TT>BSTR * pVal</TT>, that is passed
to the <TT>get_CaptionProp</TT> function does not already point to another string;
if it does, you need to destroy it. Next <TT>get_CaptionProp</TT> uses the function
<TT>SysAllocString</TT> to create a <TT>BSTR </TT>that is returned from the function
call. Note that it is first necessary to convert the <TT>ANSI</TT> string to an <TT>OLECHAR</TT>
string and then allocate a <TT>BSTR</TT> from that. The macros <TT>USES_CONVERSION</TT>
and <TT>T2OLE</TT> accomplish this for you.
<H3><A NAME="Heading16"></A>Listing 8.9 ATLCONTROLWIN.CPP--get_CaptionProp Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::get_CaptionProp(VARIANT
varAlignment, BSTR * pVal) <BR>
{ <BR>
// needed for the T2OLE macro <BR>
USES_CONVERSION; <BR>
// if there is a string <BR>
if(*pVal) <BR>
{ <BR>
// free the string because we are going to replace it <BR>
::SysFreeString(*pVal); <BR>
// clear the reference just to be safe <BR>
*pVal = NULL; <BR>
} <BR>
// convert the ANSI string to an OLECHAR and then allocate a BSTR <BR>
*pVal = ::SysAllocString(T2OLE(m_lptstrCaption)); <BR>
return S_OK; <BR>
} </TT></FONT></P>
<P><TT>put_CaptionProp</TT> simply defers to the <TT>CaptionMethod</TT> implementation
because the <TT>CaptionMethod</TT> already does everything that you need (see Listing
8.10).
<H3><A NAME="Heading17"></A>Listing 8.10 ATLCONTROLWIN.CPP--SetCaptionProp Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::put_CaptionProp(VARIANT
varAlignment, BSTR newVal) <BR>
{ <BR>
long lRetVal; <BR>
// defer to the CaptionMethod implementation <BR>
HRESULT hResult = this-&gt;CaptionMethod(newVal, 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>
// return the result <BR>
return hResult; <BR>
} </TT></FONT></P>
<H3><A NAME="Heading18"></A>Creating Stock Properties</H3>
<P>A <I>stock property</I> is a property that is understood by a control and its
container and that has a predefined meaning to both. Stock properties are intended
to provide basic uniform functionality to all the controls and containers that implement
them. Stock properties do not require you to implement a lot of code; you just hook
into the existing property.</P>
<P>Stock properties can be added to a control in two ways. The first way is during
the actual creation of the control using the ATL Object Wizard. You may recall that
earlier in the chapter one of the options in the ATL Object Wizard Properties dialog
was the Stock Properties tab (refer to fig. 8.8). If you add the stock properties
at this point, the ATL Object Wizard will add the class <TT>CStockPropImpl&lt;...&gt;</TT>
to your class declaration and will add the necessary IDL <TT>get_/put_</TT> function
declarations for each one of the properties.</P>
<P>The Object Wizard will also add a member variable to your class for each one of
the properties. The <TT>CStockPropImpl&lt;...&gt;</TT> template class contains declarations
for all of the available stock properties in the form of <TT>IMPLEMENT_STOCKPROP</TT>
and <TT>IMPLEMENT_BSTR_STOCKPROP</TT> macros. The macros define all of the appropriate
<TT>get_/put_</TT> function implementations for you; you need to use only the member
variable when you want to use the stock property. If you want to, you can also add
the <TT>CStockPropImpl&lt;...&gt;</TT> class after your control object has been created
and follow the same steps that were outlined in the preceding paragraph when creating
stock properties. Note that the <TT>CStockPropImpl&lt;...&gt;</TT> class replaces
the <TT>IDispatchImpl&lt;...&gt;</TT> class.</P>
<P>The second method of adding a stock property is the same method as for any other
user defined property. From the ClassView tab in the Project Workspace window, select
the <TT>IATLControlWin</TT> class, click the right mouse button, and select the Add
<U>P</U>roperty menu item. <BR>
<BR>
<IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>NOTE:</B> The documentation about the use of the <TT>IMPLEMENT_STOCKPROP</TT>
	and <TT>IMPLEMENT_BSTR_STOCKPROP</TT> macros within your class is somewhat misleading.
	The macros depend on the <TT>CStockPropImpl&lt;...&gt;</TT> class, and they cannot
	simply be added to your control implementation, as is implied by the documentation
	on ATL support of stock properties.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"><BR>
<BR>
In the Add Property to Interface dialog, set the Property <U>T</U>ype to <TT>OLE_COLOR</TT>,
the Property <U>N</U>ame to <TT>BackColor</TT>, and leave the remainder of the settings
at their default values (see fig. 8.14). Click OK to confirm the entry and close
the dialog. <B><BR>
<BR>
</B><A HREF="Art/08/gfigs14.jpg"><B>FIG. 8.14</B></A> <BR>
<I>Add the <TT>BackColor</TT> stock property to the control with the ATL ClassWizard.</I></P>
<P>The next step is to modify the IDL file to reflect the correct dispid for the
<TT>BackColor</TT> property. In this case, you need to replace the <TT>id</TT> with
<TT>DISPID_BACKCOLOR</TT>.
<H3><A NAME="Heading19"></A>Listing 8.11 ATLCONTROL.IDL--Add the Constant DISPID_BACKCOLOR
to the IDL to Support the BackColor Stock Property</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
interface IATLControlWin : IDispatch <BR>
{ <BR>
[id(1), helpstring(&quot;method CaptionMethod&quot;)] <BR>
HRESULT CaptionMethod([in] BSTR bstrCaption, <BR>
[in, optional] VARIANT varAlignment, [out, retval] long * lRetVal); <BR>
[propget, id(DISPID_BACKCOLOR), helpstring(&quot;property BackColor&quot;)] <BR>
HRESULT BackColor([out, retval] OLE_COLOR *pVal); <BR>
[propput, id(DISPID_BACKCOLOR), helpstring(&quot;property BackColor&quot;)] <BR>
HRESULT BackColor([in] OLE_COLOR newVal); <BR>
[propget, id(dispidCaptionProp), helpstring(&quot;property CaptionProp&quot;)] <BR>
HRESULT CaptionProp([in, optional] VARIANT varAlignment, <BR>
[out, retval] BSTR *pVal); <BR>
[propput, id(dispidCaptionProp), helpstring(&quot;property CaptionProp&quot;)] <BR>
HRESULT CaptionProp([in, optional] VARIANT varAlignment, <BR>
[in] BSTR newVal); <BR>
[propget, id(dispidAlignment), helpstring(&quot;property Alignment&quot;)] <BR>
HRESULT Alignment([out, retval] long *pVal); <BR>
[propput, id(dispidAlignment), helpstring(&quot;property Alignment&quot;)] <BR>
HRESULT Alignment([in] long newVal); <BR>
}; <BR>
. . . </TT></FONT></P>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男女男精品视频网| 日韩一区二区在线观看视频| 久久久国产精品午夜一区ai换脸| 青娱乐精品在线视频| 国产精品女同一区二区三区| 成人黄色一级视频| 亚洲美女视频在线观看| 欧美天堂亚洲电影院在线播放| ㊣最新国产の精品bt伙计久久| 色综合久久久久网| 日韩精品一卡二卡三卡四卡无卡| 欧美一二三区在线观看| 色综合一个色综合亚洲| 偷拍与自拍一区| 精品国产制服丝袜高跟| 国产91高潮流白浆在线麻豆| 亚洲免费在线看| 亚洲国产精品成人综合色在线婷婷 | 亚洲一区二区欧美| 欧美二区在线观看| 国内精品自线一区二区三区视频| 国产精品国产三级国产a| 欧美三级视频在线观看| 久久国产夜色精品鲁鲁99| 亚洲婷婷国产精品电影人久久| 欧美日韩国产欧美日美国产精品| 国内精品国产成人国产三级粉色| 日韩**一区毛片| 欧美国产日韩在线观看| 久久夜色精品一区| 欧美性生活一区| 99精品一区二区| 六月丁香综合在线视频| 偷拍自拍另类欧美| 日韩成人午夜电影| 日韩黄色在线观看| 亚洲国产成人porn| 中文字幕亚洲在| 中文字幕乱码久久午夜不卡| 国产午夜精品一区二区三区四区| 91福利视频久久久久| 激情丁香综合五月| 久久99国产精品麻豆| 一区二区三区高清在线| 久久久久国产精品免费免费搜索| 欧美不卡在线视频| 欧美影院一区二区三区| 在线视频国内自拍亚洲视频| 国产很黄免费观看久久| 午夜久久福利影院| 性久久久久久久久久久久| 国产精品第四页| 国产精品成人一区二区艾草| 最新久久zyz资源站| 亚洲欧美日韩国产一区二区三区| 亚洲视频在线观看三级| 亚洲成精国产精品女| 日本视频免费一区| 久久国产三级精品| 成人aa视频在线观看| 91理论电影在线观看| 丁香婷婷综合色啪| 91色.com| 91精品国产品国语在线不卡| 91精品福利在线| 欧美日韩第一区日日骚| 2020日本不卡一区二区视频| 日本成人在线看| 国产精品 欧美精品| 国产成人在线看| 成人免费看黄yyy456| 国产一区在线观看麻豆| 日本va欧美va瓶| 国产成人精品三级麻豆| 色婷婷av一区二区| 色综合天天综合色综合av | 欧美色区777第一页| 国产精品无码永久免费888| 男人的j进女人的j一区| 欧美乱妇15p| 一区二区三区在线影院| 国产99久久久久久免费看农村| 欧美一级艳片视频免费观看| 亚洲国产中文字幕在线视频综合| 91亚洲精品久久久蜜桃网站 | 精品一区二区三区视频在线观看| 欧美亚洲精品一区| 亚洲人成影院在线观看| 成人黄色在线看| 欧美激情一区不卡| 国产成人在线影院| 久久久噜噜噜久久人人看| 美女一区二区三区| bt欧美亚洲午夜电影天堂| 欧美蜜桃一区二区三区| 亚洲一区二区五区| 在线观看不卡视频| 一区二区视频在线看| 美女性感视频久久| 欧美一区二区成人| 免费人成网站在线观看欧美高清| 欧美日韩一区二区三区免费看| 一区二区三区色| 色狠狠av一区二区三区| 亚洲三级理论片| 日本精品一区二区三区高清| 一区二区三区自拍| 欧美日韩在线一区二区| 性做久久久久久| 91精品国产91久久久久久最新毛片| 亚洲成av人片观看| 91精品国产综合久久福利软件| 日本不卡视频在线| 欧美成人女星排行榜| 精品一区二区三区欧美| 久久综合九色综合97婷婷| 国产精品亚洲午夜一区二区三区 | 在线欧美日韩精品| 一区二区三区免费在线观看| 欧美天天综合网| 日韩vs国产vs欧美| 精品久久久久久久久久久久久久久| 激情伊人五月天久久综合| 久久久久久黄色| 不卡av电影在线播放| 亚洲欧美日韩综合aⅴ视频| 91国偷自产一区二区三区成为亚洲经典| 亚洲男人电影天堂| 欧美日韩精品福利| 久久精品国产亚洲一区二区三区 | 国产精品18久久久久久久网站| 国产精品久久影院| 欧美日韩色综合| 国产在线不卡一区| 中文字幕一区二区三区蜜月| 欧美做爰猛烈大尺度电影无法无天| 日韩在线观看一区二区| 国产欧美一区二区三区网站| 国产露脸91国语对白| 亚洲欧美日韩电影| 欧美一区二区三区思思人| 丁香五精品蜜臀久久久久99网站| 亚洲一区二区四区蜜桃| 精品对白一区国产伦| 91视频精品在这里| 午夜视频久久久久久| 亚洲国产精品av| 欧美三级电影在线看| 国产精品性做久久久久久| 悠悠色在线精品| 精品国产99国产精品| 91美女蜜桃在线| 久久99最新地址| 亚洲精品免费一二三区| 日韩欧美高清dvd碟片| 麻豆91在线播放| 国产精品久久久久aaaa樱花| 欧美日本韩国一区二区三区视频| 国产一区二区精品久久91| 一区二区三区欧美久久| 国产亚洲午夜高清国产拍精品| 色狠狠av一区二区三区| 国产传媒久久文化传媒| 日韩中文字幕不卡| 最新热久久免费视频| 欧美精品一区二区三区高清aⅴ| 91免费在线视频观看| 精品一区二区在线观看| 亚洲综合一区在线| 国产精品美女久久久久久久| 日韩欧美中文字幕公布| 在线看国产一区| 成人午夜激情视频| 精品一区二区三区蜜桃| 亚洲国产精品一区二区久久恐怖片| 中文字幕巨乱亚洲| 久久影院电视剧免费观看| 777欧美精品| 狠狠色丁香久久婷婷综| 亚洲第一狼人社区| 亚洲视频一区在线| 日本一区二区成人| 久久久精品免费观看| 欧美岛国在线观看| 69av一区二区三区| 色妞www精品视频| 成人成人成人在线视频| 国产精品一级二级三级| 久久丁香综合五月国产三级网站| 亚洲第一福利一区| 亚洲激情在线播放| 中文字幕五月欧美| 欧美国产精品专区| 亚洲精品在线观看网站| 日韩免费高清电影| 777久久久精品| 欧美一区二区三区四区久久| 欧美精品三级在线观看| 欧美图片一区二区三区| 欧美视频在线一区二区三区 |