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

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

?? ch08.htm

?? 用vc開發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一区二区三区免费野_久草精品视频
91精品国产乱| 国产精品亚洲午夜一区二区三区| 91丨九色丨蝌蚪丨老版| 国产日本欧美一区二区| 国产成人午夜精品影院观看视频 | 夜色激情一区二区| 欧美视频自拍偷拍| 日韩二区三区四区| 精品1区2区在线观看| 国产成人在线视频网址| 中文字幕一区在线| 欧美影院精品一区| 奇米四色…亚洲| 国产女人18水真多18精品一级做| 成人妖精视频yjsp地址| 亚洲美女视频在线观看| 欧美精品成人一区二区三区四区| 久久99精品一区二区三区三区| 久久亚洲免费视频| 99视频热这里只有精品免费| 亚洲一区二区在线观看视频| 91精品国产入口| 粉嫩av一区二区三区| 一级中文字幕一区二区| 欧美不卡一区二区三区四区| 国产成人精品一区二区三区四区| 一区二区三区中文字幕电影 | 99精品一区二区| 婷婷开心激情综合| 国产亚洲短视频| 欧美综合一区二区| 国产精品一色哟哟哟| 一区二区三区在线高清| 欧美精品一区二区三区蜜桃 | 日日欢夜夜爽一区| 国产日韩欧美a| 欧美日韩国产欧美日美国产精品| 国产在线视频不卡二| 一区二区三区不卡在线观看 | 亚洲色图在线播放| 久久综合九色综合欧美98| 色综合激情五月| 国产毛片一区二区| 日韩成人免费电影| 亚洲伦在线观看| 亚洲精品一线二线三线| 欧美日韩在线播放三区四区| 国产成人自拍在线| 久久99国产乱子伦精品免费| 一区二区三区**美女毛片| 国产视频一区不卡| 精品国产区一区| 欧美视频一区二区三区四区| 国产91精品露脸国语对白| 美女看a上一区| 亚洲高清免费观看高清完整版在线观看| 久久这里只有精品6| 欧美一区二区三区在线视频| 在线观看免费亚洲| 99国产精品一区| 国产激情一区二区三区四区| 日本亚洲最大的色成网站www| 亚洲女与黑人做爰| 中文字幕亚洲精品在线观看 | 欧美一级黄色大片| 欧美日韩情趣电影| 色偷偷成人一区二区三区91| 成人在线一区二区三区| 国产乱淫av一区二区三区| 精品一区二区三区香蕉蜜桃| 日本大胆欧美人术艺术动态 | 麻豆国产精品一区二区三区| 亚洲成人动漫一区| 亚洲国产三级在线| 亚洲成人动漫av| 舔着乳尖日韩一区| 日韩在线观看一区二区| 午夜精品久久久久久久| 亚洲国产毛片aaaaa无费看 | 中文字幕在线不卡一区| 中文乱码免费一区二区| 欧美精彩视频一区二区三区| 久久精品一区二区| 国产日韩成人精品| 国产精品丝袜在线| 国产精品电影院| 亚洲免费观看在线视频| 亚洲永久精品国产| 亚洲成av人片一区二区| 日韩精品国产精品| 国产一区二区在线看| 国产乱码精品一区二区三区av | 精品国产一区二区三区不卡| 久久综合色天天久久综合图片| 久久夜色精品一区| 亚洲国产成人在线| 亚洲欧美视频一区| 婷婷综合久久一区二区三区| 久久精品噜噜噜成人av农村| 国模冰冰炮一区二区| 成人午夜在线免费| 91日韩在线专区| 欧美日韩国产高清一区二区| 欧美精品在线视频| 26uuu精品一区二区三区四区在线| 26uuu精品一区二区 | 亚洲愉拍自拍另类高清精品| 亚洲v日本v欧美v久久精品| 久久成人免费网| 成人不卡免费av| 欧美日韩一级大片网址| 欧美一区二区视频观看视频| 国产欧美日韩综合| 亚洲一区二区四区蜜桃| 韩国av一区二区三区| k8久久久一区二区三区| 欧美一区日韩一区| 中文字幕欧美日韩一区| 亚洲大片免费看| 国产激情精品久久久第一区二区 | 91视频观看免费| 91精品在线观看入口| 国产精品美女久久久久久久网站| 亚洲综合免费观看高清在线观看| 久久爱www久久做| 91麻豆国产在线观看| 精品三级在线看| 亚洲男人的天堂一区二区| 久久精品国产久精国产| 色综合视频一区二区三区高清| 日韩免费看的电影| 亚洲摸摸操操av| 国产成人免费视频一区| 欧美欧美午夜aⅴ在线观看| 中文字幕va一区二区三区| 伊人婷婷欧美激情| 国产成人精品亚洲午夜麻豆| 欧美高清精品3d| 亚洲欧美电影院| 国产91在线|亚洲| 91精品国产全国免费观看| 亚洲视频一二区| 懂色av中文一区二区三区 | 美国一区二区三区在线播放| 91视频一区二区三区| 久久久久久久精| 精品一区中文字幕| 欧美猛男超大videosgay| 亚洲特级片在线| 成人午夜电影网站| 2021中文字幕一区亚洲| 日韩精品成人一区二区在线| 91黄色小视频| 亚洲欧洲制服丝袜| 丁香六月综合激情| 精品福利二区三区| 精品一区二区三区在线观看| 欧美一区二区在线观看| 五月天亚洲精品| 欧美日本一区二区| 亚洲午夜视频在线| av色综合久久天堂av综合| 国产欧美日本一区二区三区| 精品一区二区三区欧美| 日韩欧美色综合网站| 日本成人在线电影网| 正在播放亚洲一区| 五月天中文字幕一区二区| 91在线观看美女| 亚洲欧洲美洲综合色网| 99精品一区二区| 曰韩精品一区二区| 欧美亚男人的天堂| 五月婷婷综合激情| 日韩一级视频免费观看在线| 日本女优在线视频一区二区| 日韩欧美国产综合| 国产一区欧美一区| 中文字幕av一区二区三区高| 处破女av一区二区| 日韩美女精品在线| 欧美性三三影院| 日韩黄色在线观看| 欧美精品一区二区三区视频| 国产成人av电影在线播放| 国产精品区一区二区三区| 99久久婷婷国产| 亚洲国产日韩a在线播放性色| 欧美肥胖老妇做爰| 久久99国产精品免费网站| 国产午夜亚洲精品不卡 | 欧洲亚洲国产日韩| 视频精品一区二区| 2020国产成人综合网| 成人黄页毛片网站| 亚洲国产精品一区二区久久恐怖片| 欧美人妖巨大在线| 韩国av一区二区三区| 最新日韩av在线| 日韩一区二区三区视频|