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

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

?? ch03.htm

?? 用VC開發(fā)ACTIVEX書籍和隨書源碼
?? HTM
?? 第 1 頁(yè) / 共 5 頁(yè)
字號(hào):
<BR>
// set the source file <BR>
pOleDispExcep-&gt;m_strSource = __FILE__; <BR>
// format the error description <BR>
pOleDispExcep-&gt;m_strDescription = _T(&quot;Unable to retrieve the lower bound
dimension of the array.&quot;); <BR>
// the function call failed cause an ole exception <BR>
throw(pOleDispExcep); <BR>
} <BR>
// unlock the array we don't need it anymore <BR>
::SafeArrayUnlock(varOutputArray-&gt;parray); <BR>
} <BR>
else <BR>
{ <BR>
bResult = VARIANT_FALSE; <BR>
// unable to get a record based on the sql statement - throw an exception <BR>
COleDispatchException * pOleDispExcep = new COleDispatchException(_T(&quot;&quot;),
NULL, 0); <BR>
// format the error code <BR>
pOleDispExcep-&gt;m_scError = MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, MFCSERVER_E_NO_ARRAYLOCK);
<BR>
// set the source file <BR>
pOleDispExcep-&gt;m_strSource = __FILE__; <BR>
// format the error description <BR>
pOleDispExcep-&gt;m_strDescription = _T(&quot;Unable to lock the array memory.&quot;);
<BR>
// the function call failed cause an ole exception <BR>
throw(pOleDispExcep); <BR>
} <BR>
} <BR>
else <BR>
{ <BR>
bResult = VARIANT_FALSE; <BR>
// unable to get a record based on the sql statement - throw an exception <BR>
COleDispatchException * pOleDispExcep = new COleDispatchException(_T(&quot;&quot;),
NULL, 0); <BR>
// if we didn't have a file handle <BR>
if(!m_fileLog) <BR>
// format the error code <BR>
pOleDispExcep-&gt;m_scError = MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, MFCSERVER_E_NO_FILE);
<BR>
else <BR>
// format the error code <BR>
pOleDispExcep-&gt;m_scError = MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, MFCSERVER_E_BAD_ARRAY_PARAMETER);
<BR>
// set the source file <BR>
pOleDispExcep-&gt;m_strSource = __FILE__; <BR>
// if we didn't have a file handle <BR>
if(!m_fileLog) <BR>
// format the error description <BR>
pOleDispExcep-&gt;m_strDescription = _T(&quot;Invalid File Handle. File could not
be opened for output.&quot;); <BR>
else <BR>
// format the error description <BR>
pOleDispExcep-&gt;m_strDescription = _T(&quot;The first parameter must be a string
array passed by reference.&quot;); <BR>
// the function call failed cause an ole exception <BR>
throw(pOleDispExcep); <BR>
} <BR>
// return the result <BR>
return bResult; <BR>
} <BR>
long CTracker::GetIndent() <BR>
{ <BR>
// return the member variable <BR>
return m_lIndent; <BR>
} <BR>
void CTracker::SetIndent(long nNewValue) <BR>
{ <BR>
// if the new value is a least 0 <BR>
if(nNewValue &gt;= 0) <BR>
// assign the value to our member variable <BR>
m_lIndent = nNewValue; <BR>
else <BR>
{ <BR>
// unable to get a record based on the sql statement - throw an exception <BR>
COleDispatchException * pOleDispExcep = new <BR>
<BR>
<BR>
<BR>
COleDispatchException(_T(&quot;&quot;), NULL, 0); <BR>
// format the error code <BR>
pOleDispExcep-&gt;m_scError = MAKE_SCODE(SEVERITY_ERROR, FACILITY_ITF, MFCSERVER_E_INVALID_VALUE);
<BR>
// set the source file <BR>
pOleDispExcep-&gt;m_strSource = __FILE__; <BR>
// format the error description <BR>
pOleDispExcep-&gt;m_strDescription = _T(&quot;Invalid value. Value must be 0 or greater.&quot;);
<BR>
// the function call failed cause an ole exception <BR>
throw(pOleDispExcep); <BR>
} <BR>
<BR>
} </TT></FONT></P>
<P>Exceptions are useful for communicating error conditions and problems back to
the application and developer who are using an ActiveX component. Make use of them
whenever you can to further enhance your implementation.
<H2><A NAME="Heading24"></A>Dual-Interface</H2>
<P>Dual-interface is exactly what it sounds like: The server implementation supports
two interfaces with which to talk to the server. One interface, an IDispatch<I> interface,</I>
is what you have been working with so far. The other, a <I>custom interface, </I>is
a type of interface that you have not looked at yet. The dual portion refers to the
fact that no matter which interface you choose, you are always talking to the same
server, and you will always get the same response.</P>
<P>An <TT>IDispatch</TT>-based interface uses a generic mechanism for calling methods
and properties in a server. When a method in a server is called, you pass the ID
of the method to invoke and a structure describing its parameters and return type.
This data is packaged and sent to the server, which unpackages the data and calls
the appropriate method based on the ID supplied.</P>
<P>A custom interface, on the other hand, is very different. When using a custom
interface, you are talking directly to the server's functions and are not depending
on a generic mechanism for invoking the methods or properties. The packaging of the
parameters and return value are left to the compiler that created the applications.</P>
<P>Since the interfaces are written to access the same set of functions, the custom
interface portion of a dual-interface server must conform to the same data type restrictions
imposed by Automation. This way, you are not required to create your own code to
transfer data between the two applications: the controller and the server. OLE does
that for you with standard marshaling.</P>
<P>The major advantage to dual-interface is performance. The number of steps to call
a method using the custom interface is far less than the number needed to call a
method when using the <TT>IDispatch</TT> interface.</P>
<P>The main disadvantage to dual-interface support in MFC servers is that they are
not supported by the ClassWizard and will require manual changes to implement. The
code involved is not too difficult to maintain; the hardest part is probably remembering
to do it. <BR>
<BR>
<IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>NOTE:</B> The advantage of using the custom interface of a dual-interface server
	loses its luster when executing across process boundaries. The custom interface is
	still faster, but not by much. The real performance benefit, a 25 to 50 percent improvement,
	is when the server is in-process to the calling application. The amount of improvement
	depends on the number and types of parameters that are being passed between the applications.
	If you are interested in seeing actual numbers regarding the amount of performance
	improvement, you can refer to recent Microsoft Systems Journal articles, which have
	focused on performance differences between <TT>IDispatch</TT> and custom interfaces.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"><BR>
<BR>
The first step when converting an MFC-based ActiveX server to dual-interface is to
change the ODL file. Listing 3.14 shows the changes that have been made to the server
to support dual-interface. It is not necessary to generate new <TT>UUID</TT>s because
the functionality of the server has not changed. You must add the <TT>oleautomation</TT>
and <TT>dual</TT> attributes to the interface class, though. You also add the <TT>hidden</TT>
attribute, so this interface will not be visible within VB. This is fine since VB
will display the <TT>CoClass</TT> interface and will also show all of the methods
and properties for the server. As a general rule, you should always hide your interfaces
and leave visible the <TT>CoClasses</TT> used to create them. This is because applications
like VB will display both interfaces, and the reality is that only the <TT>CoClass</TT>
name is valid in VB; if you try to reference an object by its interface name, you
will get an error.</P>
<P>Since the server supports dual-interface, you must change your interface declaration
to inherit from the <TT>IDispatch</TT> interface rather than declare the interface
as type <TT>dispinterface</TT>, as in the original implementation. Dual-interface
method and property declarations are different from <TT>dispinterface</TT> declarations,
which are more like standard C++. Note that keywords such as <TT>method</TT> and
<TT>properties</TT> are no longer within the interface declaration. Those terms are
keywords related to the <TT>dispinterface</TT> keyword. As we stated earlier, properties
are accessed using a pair of methods sharing the same dispid. The distinguishing
factors are the method attributes <TT>propget</TT> and <TT>propput,</TT> which denote
the direction of data flow. You must also change the <TT>CoClass</TT> to refer to
interface and not <TT>dispinterface</TT>.</P>
<P>All dual-interface methods must return an <TT>HRESULT</TT> data type. If a method
requires a return value, it must be specified as the last parameter of the method
and must have the parameter attributes of <TT>out</TT> and <TT>retval</TT>. All parameters
must have an attribute describing the direction of data flow. See Table 3.3 for a
complete description of the possible attributes and combinations. 
<TABLE BORDER="1" WIDTH="100%">
	<CAPTION><B>Table 3.3</B><SPACER TYPE="HORIZONTAL" SIZE="10"><B> Parameter Flow Attributes</B></CAPTION>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><B>Direction</B></TD>
		<TD ALIGN="LEFT" VALIGN="TOP"><B>Description</B></TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><TT>in</TT></TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Parameter is passed from caller to callee.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><TT>out</TT></TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Parameter is returned from callee to caller.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><TT>in</TT>, <TT>out</TT></TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Parameter is passed from caller to callee, and the callee returns a parameter.</TD>
	</TR>
	<TR ALIGN="LEFT" rowspan="1">
		<TD ALIGN="LEFT" VALIGN="TOP"><TT>out</TT>, <TT>retval</TT></TD>
		<TD ALIGN="LEFT" VALIGN="TOP">Parameter is the return value of the method and is returned from the callee to the
			caller.</TD>
	</TR>
</TABLE>

<H3><A NAME="Heading25"></A>Listing 3.14 MFCSERVER.ODL--ODL Changes to Support Dual-Interface</H3>
<P><FONT COLOR="#0066FF"><TT>[ uuid(11C82943-4EDD-11D0-BED8-00400538977D), version(1.0)
] <BR>
library MFCServer <BR>
{ <BR>
importlib(&quot;stdole32.tlb&quot;); <BR>
<BR>
[ uuid(11C82946-4EDD-11D0-BED8-00400538977D), oleautomation, dual, hidden ] <BR>
interface ITracker: IDispatch <BR>
{ <BR>
[id(1), propget] HRESULT Indent([out, retval] long * Value); <BR>
[id(1), propput] HRESULT Indent([in] long Value); <BR>
[id(2)] HRESULT OutputLines([in] VARIANT * varOutputArray, [in, optional] VARIANT
varIndent, [out, retval] boolean * RetVal); <BR>
}; <BR>
// CoClass for CTracker <BR>
[ uuid(11C82947-4EDD-11D0-BED8-00400538977D) ] <BR>
coclass TRACKER <BR>
{ <BR>
[default] interface ITracker; <BR>
}; <BR>
typedef [uuid(11C82948-4EDD-11D0-BED8-00400538977D), helpstring(&quot;Tracker Error
Constants&quot;)] <BR>
#include &quot;trackererror.h&quot; <BR>
//{{AFX_APPEND_ODL}} <BR>
<BR>
}; </TT></FONT></P>
<P>The remainder of the ODL file entries do not have to be changed to support dual-interface.
<BR>
<BR>
<IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"></P>


<BLOCKQUOTE>
	<P><B>NOTE:</B> The changes that have been made to the ODL file will prevent the
	ClassWizard from updating the ODL file automatically when new methods and properties
	are added. You are now responsible for maintaining the entries manually.

</BLOCKQUOTE>

<P><IMG SRC="bar.gif" WIDTH="480" HEIGHT="6" ALIGN="BOTTOM" BORDER="0"><BR>
<BR>
The ODL compiler has the capability of generating a C++ header file that describes
all of the interfaces and enumerations that are contained in the type library that
you've created for your server. The ODL-generated header file is useful for creating
function prototypes that are required in the implementation of the server. You add
the entry to the ODL file and compile it into a type library. Next copy the new method
from the header file into your class definition and make some minor changes--and
everything is finished. In addition, you now have an interface file that can be used
by other applications to access the custom interface of your server as well as t

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区免费在线观看| 99国产精品久久久久| 6080yy午夜一二三区久久| 夜夜嗨av一区二区三区中文字幕| 色婷婷综合久久久| 亚洲精品国产一区二区三区四区在线| 色综合久久六月婷婷中文字幕| 一级女性全黄久久生活片免费| 欧美系列亚洲系列| 五月天激情综合| 久久亚洲欧美国产精品乐播| 粉嫩aⅴ一区二区三区四区 | 国产高清不卡一区二区| 国产日韩高清在线| 色香色香欲天天天影视综合网| 亚洲综合男人的天堂| 欧美一二三四在线| 成人av在线网| 日韩在线一二三区| 久久久久久97三级| 欧美亚州韩日在线看免费版国语版| 五月天婷婷综合| 中文字幕国产精品一区二区| 91精品福利视频| 韩国一区二区三区| 一区二区三区欧美| 欧美精品一区二区精品网| 99精品久久免费看蜜臀剧情介绍| 日韩va欧美va亚洲va久久| 国产偷国产偷亚洲高清人白洁| 色偷偷久久人人79超碰人人澡| 久久成人免费电影| 亚洲制服丝袜在线| 欧美激情一区二区三区在线| 欧美日韩免费电影| 不卡影院免费观看| 久久精品国产在热久久| 亚洲老司机在线| 久久久久久电影| 欧美一区二区三区免费大片| 99久久精品国产网站| 极品瑜伽女神91| 亚洲成人动漫在线观看| 日本一区二区免费在线| 91精品综合久久久久久| 一本一道久久a久久精品| 极品少妇xxxx精品少妇| 亚洲一区在线看| 国产精品沙发午睡系列990531| 91精品国产综合久久福利软件| 91视视频在线直接观看在线看网页在线看| 麻豆精品视频在线| 亚洲一卡二卡三卡四卡 | 91精品国产入口| 92国产精品观看| 国产精品夜夜嗨| 麻豆高清免费国产一区| 天堂午夜影视日韩欧美一区二区| 日韩一区日韩二区| 国产精品网站在线观看| 久久久久99精品国产片| 91精品国产色综合久久久蜜香臀| 色综合一区二区| 91在线免费播放| 91丨九色porny丨蝌蚪| 成人综合激情网| 国产成人av影院| 国产一区二区三区免费在线观看| 爽爽淫人综合网网站| 亚洲综合一区二区| 一区二区三区**美女毛片| 国产精品传媒入口麻豆| 国产精品五月天| 综合激情成人伊人| 亚洲色图色小说| 一级日本不卡的影视| 亚洲高清三级视频| 亚洲va天堂va国产va久| 亚洲日穴在线视频| 一区二区三区在线观看网站| 亚洲激情自拍偷拍| 亚洲综合区在线| 日韩精品电影在线| 美腿丝袜亚洲色图| 久久99精品国产麻豆婷婷| 久久成人久久鬼色| 国产伦精一区二区三区| 丁香桃色午夜亚洲一区二区三区| 国产91在线观看| 99在线精品一区二区三区| 色呦呦网站一区| 欧美麻豆精品久久久久久| 91精品国产入口在线| 337p日本欧洲亚洲大胆精品| 久久综合九色综合欧美就去吻| 亚洲国产精品黑人久久久 | 日韩理论片中文av| 亚洲一区在线看| 麻豆精品在线观看| 国产成人精品免费| 日本道在线观看一区二区| 6080国产精品一区二区| 欧美精品一区视频| 日韩码欧中文字| 免费在线观看视频一区| 国产麻豆一精品一av一免费| 99久久精品费精品国产一区二区| 在线免费观看日本一区| 欧美一级爆毛片| 国产精品传媒入口麻豆| 五月天丁香久久| 大尺度一区二区| 欧美午夜片在线观看| 精品美女一区二区| ...xxx性欧美| 美女视频黄久久| 99re66热这里只有精品3直播| 欧美精品黑人性xxxx| 欧美激情一区二区| 日韩国产成人精品| 成人精品国产免费网站| 欧美一区日韩一区| 亚洲欧美精品午睡沙发| 麻豆91免费观看| 一本一本久久a久久精品综合麻豆| 欧美一区三区二区| 亚洲免费在线观看| 黑人精品欧美一区二区蜜桃| 成人精品视频一区| 日韩一区二区三区在线视频| 亚洲欧美怡红院| 激情六月婷婷久久| 欧美日韩精品一区二区天天拍小说| 久久免费国产精品 | 精品一区二区三区在线播放| 9l国产精品久久久久麻豆| 日韩一区二区三区av| 亚洲一区二区黄色| 成人黄色小视频| 久久久91精品国产一区二区三区| 偷拍亚洲欧洲综合| 北条麻妃一区二区三区| 久久综合色一综合色88| 午夜视黄欧洲亚洲| 91九色最新地址| 17c精品麻豆一区二区免费| 国产美女娇喘av呻吟久久| 欧美一级午夜免费电影| 午夜天堂影视香蕉久久| 一本到高清视频免费精品| 国产调教视频一区| 国产主播一区二区三区| 欧美电影免费观看完整版| 天天操天天干天天综合网| 色久综合一二码| 亚洲欧美色图小说| 91女神在线视频| 136国产福利精品导航| 9色porny自拍视频一区二区| 国产亚洲成aⅴ人片在线观看 | 亚洲国产精品视频| 欧美午夜精品电影| 亚洲国产成人91porn| 欧美日韩中文一区| 亚洲一二三专区| 欧美色窝79yyyycom| 亚洲第四色夜色| 欧美影院一区二区三区| 午夜影院在线观看欧美| 欧美日韩日日骚| 日韩一区欧美二区| 日韩一级在线观看| 精品一区二区三区在线观看| 精品久久久影院| 国产不卡在线一区| 自拍偷拍亚洲激情| 欧美视频精品在线观看| 日日夜夜免费精品| 精品动漫一区二区三区在线观看| 久久成人精品无人区| 国产欧美精品一区| thepron国产精品| 洋洋成人永久网站入口| 欧美私人免费视频| 麻豆视频一区二区| 欧美国产日韩亚洲一区| 色域天天综合网| 日本一区中文字幕| 国产精品一区二区在线观看不卡 | 日韩精品电影在线| 精品久久久久久久久久久院品网| 国产剧情一区在线| 亚洲欧洲日本在线| 欧美日韩视频专区在线播放| 麻豆视频观看网址久久| 中文av一区二区| 欧美日韩一区不卡| 国产精品18久久久久久vr| 成人免费小视频| 91精品国产手机|