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

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

?? ch09.htm

?? 用VC開發ACTIVEX書籍和隨書源碼
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
m_lReadyState = READYSTATE_LOADING; <BR>
// set to the first element <BR>
ulFORMATETCElement = 0; <BR>
// clear the storage medium <BR>
sTextStgMedium.hGlobal = NULL; <BR>
} <BR>
. . . </TT></FONT></P>
<P>The next step is to implement the member functions that will actually perform
the data preparation and copy operation to the Clipboard.</P>
<P><TT>CopyDataToClipboard</TT> is the function that is called to initiate the Clipboard
transfer (see Listing 9.24). You first check to see whether you are already the owner
of the Clipboard and set the Boolean variable accordingly. You then prepare your
data for the Clipboard, and finally if you are not the owner of the Clipboard, you
flush whatever data is on the Clipboard and set your <TT>IDataObject</TT> reference
on the Clipboard.
<H3><A NAME="Heading32"></A>Listing 9.24 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.CPP--CopyDataToClipboard
Helper Function Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>void CATLControlWin::CopyDataToClipboard(void) <BR>
{ <BR>
BOOL bHaveClipboard = TRUE; <BR>
// if we don't have an IDataObject on the clipboard? <BR>
if(::OleIsCurrentClipboard((IDataObject *) this) != S_OK) <BR>
// set the flag <BR>
bHaveClipboard = FALSE; <BR>
// put data in the storage <BR>
this-&gt;PrepareDataForTransfer(); <BR>
// if we don't have the clipboard <BR>
if(!bHaveClipboard) <BR>
{ <BR>
// clear the clipboard <BR>
::OleFlushClipboard(); <BR>
// put the data on the clipboard <BR>
::OleSetClipboard(reinterpret_cast&lt;IDataObject*&gt; <BR>
(static_cast&lt;IDataObjectImpl&lt;CATLControlWin&gt;*&gt;(this))); <BR>
} <BR>
} </TT></FONT></P>
<P><TT>PrepareDataForTransfer</TT> is the function that you call when you want to
copy the data from your control to the <TT>STGMEDIUM</TT> structure that will represent
your data on the Clipboard (see Listing 9.25). First you need to allocate a block
of global memory that will contain your caption in ANSI format. Then you set up the
<TT>FORMATETC</TT> and <TT>STGMEDIUM</TT> structures to reflect the correct data
type and exit the function.
<H3><A NAME="Heading33"></A>Listing 9.25 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.CPP--PrepareDataForTransfer
Helper Function Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>void CATLControlWin::PrepareDataForTransfer(void) <BR>
{ <BR>
// get the length of the data to copy <BR>
long lLength = lstrlen(m_lptstrCaption) + 1; <BR>
// create a global memory object <BR>
HGLOBAL hGlobal = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, <BR>
sizeof(TCHAR) * lLength); <BR>
// lock the memory down <BR>
LPTSTR lpTempBuffer = (LPTSTR) ::GlobalLock(hGlobal); <BR>
// copy the string <BR>
for(long lCount = 0; lCount &lt; lLength - 1; lCount++) <BR>
lpTempBuffer[lCount] = m_lptstrCaption[lCount]; <BR>
// null terminate the string <BR>
lpTempBuffer[lCount] = `\0'; <BR>
// unlock the memory <BR>
::GlobalUnlock(hGlobal); <BR>
// copy all of the members <BR>
sTextFormatEtc.cfFormat = CF_TEXT; <BR>
sTextFormatEtc.ptd = NULL; <BR>
sTextFormatEtc.dwAspect = 0; <BR>
sTextFormatEtc.lindex = -1; <BR>
sTextFormatEtc.tymed = TYMED_HGLOBAL; <BR>
// if we have already allocated the data <BR>
if(sTextStgMedium.hGlobal) <BR>
// release it <BR>
::ReleaseStgMedium(&amp;sTextStgMedium); <BR>
sTextStgMedium.tymed = TYMED_HGLOBAL; <BR>
sTextStgMedium.hGlobal = hGlobal; <BR>
sTextStgMedium.pUnkForRelease = NULL; <BR>
} </TT></FONT></P>
<P><TT>CopyStgMedium</TT> is a general purpose helper function for copying one <TT>STGMEDIUM</TT>
to another <TT>STGMEDIUM</TT> (see Listing 9.26). This implementation is important
because the function allocates a new global data object instead of copying the reference
to the existing object.
<H3><A NAME="Heading34"></A>Listing 9.26<SPACER TYPE="HORIZONTAL" SIZE="10"> ATLCONTROLWIN.CPP--CopyStgMedium
Helper Function Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>void CATLControlWin::CopyStgMedium(LPSTGMEDIUM lpTargetStgMedium,
<BR>
LPSTGMEDIUM lpSourceStgMedium, CLIPFORMAT cfSourceFormat) <BR>
{ <BR>
// copy the stgmedium members <BR>
lpTargetStgMedium-&gt;tymed = lpSourceStgMedium-&gt;tymed; <BR>
lpTargetStgMedium-&gt;pUnkForRelease = lpSourceStgMedium-&gt;pUnkForRelease; <BR>
lpTargetStgMedium-&gt;hGlobal = ::OleDuplicateData(lpSourceStgMedium-&gt;hGlobal,
<BR>
cfSourceFormat, GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT); <BR>
} </TT></FONT></P>
<P>The last step is to implement the <TT>IDataObject</TT> and <TT>IEnumFORMATETC</TT>
interfaces.</P>
<P>The <TT>IDataObject</TT> implementation is straightforward and involves only two
functions (see Listing 9.27). The remainder of the <TT>IDataObject</TT> functions
are already implemented by the ATL class <TT>IDataObjectImpl</TT>. <TT>GetData</TT>
will, if the format type matches that of a format that your control understands,
copy the control's current data to the <TT>STGMEDIUM</TT> parameter that is passed
to the control. If the format type is unrecognized, you must defer to the base class
implementation of <TT>GetData</TT>. Doing this is very important since the ATL class
<TT>CComControlBase</TT> does implement the <TT>IDataObject::GetData</TT> function
for copying <TT>metafile</TT> data formats. <TT>EnumFormatEtc</TT> is used to return
an <TT>IEnumFORMATETC</TT> reference to the requesting application so that it can
determine what types of data formats are supported by the control implementation.
Again, you must defer to the base class implementation to ensure that the control
implementation functions correctly; however, in this case, the default ATL implementation
of this function returns <TT>E_NOTIMPL</TT>.
<H3><A NAME="Heading35"></A>Listing 9.27 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.CPP--IDataObject
Interface Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
STDMETHODIMP CATLControlWin::GetData(LPFORMATETC lpFormatEtc, <BR>
LPSTGMEDIUM lpStgMedium) <BR>
{ <BR>
// if this is a format that we can deal with <BR>
if(lpFormatEtc-&gt;cfFormat == CF_TEXT &amp;&amp; lpFormatEtc-&gt;tymed &amp; TYMED_HGLOBAL)
<BR>
{ <BR>
// get a copy of the current stgmedium <BR>
this-&gt;CopyStgMedium(lpStgMedium, &amp;sTextStgMedium, CF_TEXT); <BR>
return S_OK; <BR>
} <BR>
else <BR>
return IDataObjectImpl&lt;CATLControlWin&gt;::GetData(lpFormatEtc, lpStgMedium);
<BR>
} <BR>
STDMETHODIMP CATLControlWin::EnumFormatEtc(DWORD dwDirection, <BR>
LPENUMFORMATETC* ppenumFormatEtc) <BR>
{ <BR>
// we support &quot;get&quot; operations <BR>
if(dwDirection == DATADIR_GET) <BR>
{ <BR>
// make the assignment <BR>
*ppenumFormatEtc = (IEnumFORMATETC *) this; <BR>
<BR>
// increment the reference count <BR>
(*ppenumFormatEtc)-&gt;AddRef(); <BR>
// return success <BR>
return S_OK; <BR>
} <BR>
return IDataObjectImpl&lt;CATLControlWin&gt;::EnumFormatEtc( <BR>
dwDirection, ppenumFormatEtc); <BR>
} <BR>
. . . </TT></FONT></P>
<P>The <TT>IEnumFORMATETC</TT> implementation is also simple (see Listing 9.28).
The one thing to note is that there is no default ATL implementation, so it is not
necessary to defer to the base class implementation in the case where you do not
handle the function. <TT>Next</TT> is used to retrieve the next element in the enumeration;
in this case, you need be concerned with only one element, <TT>CF_TEXT</TT>. After
filling in the <TT>FORMATETC</TT> structure with the appropriate data, you must increment
the counter and exit the function. The <TT>Skip</TT> method increments the counter
and exits the function, and <TT>Reset</TT> sets the counter back to 0.
<H3><A NAME="Heading36"></A>Listing 9.28 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.CPP--IEnumFORMATETC
Interface Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>STDMETHODIMP CATLControlWin::Next(ULONG celt, FORMATETC_RPC_FAR
* rgelt, <BR>
ULONG RPC_FAR * pceltFetched) <BR>
{ <BR>
// if we are at the beginning of the enumeration <BR>
if(ulFORMATETCElement == 0 &amp;&amp; celt &gt; 0) <BR>
{ <BR>
// copy all of the members <BR>
rgelt-&gt;cfFormat = CF_TEXT; <BR>
rgelt-&gt;ptd = NULL; <BR>
rgelt-&gt;dwAspect = 0; <BR>
rgelt-&gt;lindex = -1; <BR>
rgelt-&gt;tymed = TYMED_HGLOBAL; <BR>
<BR>
// if the caller wants to know how many we copied <BR>
if(pceltFetched) <BR>
*pceltFetched = 1; <BR>
// increment the counter <BR>
ulFORMATETCElement++; <BR>
// return success <BR>
return S_OK; <BR>
} <BR>
else <BR>
// return failure <BR>
return S_FALSE; <BR>
} <BR>
STDMETHODIMP CATLControlWin::Skip(ULONG celt) <BR>
{ <BR>
// move the counter by the number of elements supplied <BR>
ulFORMATETCElement += celt; <BR>
<BR>
// return success <BR>
return S_OK; <BR>
} <BR>
STDMETHODIMP CATLControlWin::Reset(void) <BR>
{ <BR>
// reset to the beginning of the enumerator <BR>
ulFORMATETCElement = 0; <BR>
<BR>
// return success <BR>
return S_OK; <BR>
} <BR>
STDMETHODIMP CATLControlWin::Clone( <BR>
IEnumFORMATETC_RPC_FAR *__RPC_FAR * /*ppenum*/) <BR>
{ <BR>
return E_NOTIMPL; <BR>
} </TT></FONT></P>
<P>Now that you know how to copy data to the Clipboard, you look at how to get data
from the Clipboard. <B><BR>
<BR>
Enabling a Control as a Clipboard Target</B> <SPACER TYPE="HORIZONTAL" SIZE="10">The
opposite of being a Clipboard source is being a Clipboard target. First you need
to update the <TT>CATLControlWin</TT> class declaration to include two new helper
functions (see Listing 9.29).
<H3><A NAME="Heading37"></A>Listing 9.29 <SPACER TYPE="HORIZONTAL" SIZE="10">ATLCONTROLWIN.H--Clipboard
Target Support Helper Function Prototypes</H3>
<P><FONT COLOR="#0066FF"><TT>. . . <BR>
void CopyDataToClipboard(void); <BR>
void PrepareDataForTransfer(void); <BR>
void GetDataFromClipboard(void); <BR>
void GetDataFromTransfer(IDataObject * ipDataObj); <BR>
void CopyStgMedium(LPSTGMEDIUM lpTargetStgMedium, <BR>
LPSTGMEDIUM lpSourceStgMedium, CLIPFORMAT cfSourceFormat); <BR>
. . . </TT></FONT></P>
<P>Getting data from the Clipboard is almost as easy as putting the data on the Clipboard
in the first place. The first method is <TT>GetDataFromClipboard</TT>, which, as
the name implies, gets the data from the Clipboard and transfers it to the control.
The function first checks the Clipboard to see whether the control already owns the
Clipboard. If the control does own the Clipboard, it refreshes the control's data
with the data that is stored in the <TT>STGMEDIUM</TT> structure. The implementation
is written this way because the data stored in the control may have changed since
it was pasted to the Clipboard in the first place.</P>
<P>If you don't already own the Clipboard, you get the <TT>IDataObject</TT> reference
of the object that does, and you pass the reference on to the <TT>GetDataFromTransfer</TT>
function (see Listing 9.30).
<H3><A NAME="Heading38"></A>Listing 9.30<SPACER TYPE="HORIZONTAL" SIZE="10"> MFCCONTROLWINCTL.CPP--GetDataFromClipboard
Implementation</H3>
<P><FONT COLOR="#0066FF"><TT>void CATLControlWin::GetDataFromClipboard(void) <BR>
{ <BR>
// get an IDataObject pointer <BR>
IDataObject * ipClipboardDataObj = NULL; <BR>
// do we have an IDataObject on the clipboard? <BR>
if(::OleIsCurrentClipboard((IDataObject *) this) == S_OK) <BR>
{ <BR>
// get the global data for this format and lock down the memory <BR>
LPTSTR lpTempBuffer = (LPTSTR) ::GlobalLock(sTextStgMedium.hGlobal); <BR>
// if we have a string <BR>
if(m_lptstrCaption) <BR>
{ <BR>
// delete the existing string <BR>
delete [] m_lptstrCaption; <BR>
// clear the reference just to be safe <BR>
m_lptstrCaption = NULL; <BR>
} <BR>
// allocate a new string <BR>
m_lptstrCaption = new TCHAR[lstrlen(lpTempBuffer) + 1]; <BR>
// assign the string to our member variable <BR>
lstrcpy(m_lptstrCaption, lpTempBuffer); <BR>
// unlock the m

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人网在线免费视频| 精品国产乱码久久| 久久综合色一综合色88| 亚洲视频在线观看三级| 狠狠色丁香婷综合久久| 在线观看日韩电影| 国产精品第四页| 国产一区二区三区在线观看免费 | 亚洲一区二区在线观看视频| 精品无人区卡一卡二卡三乱码免费卡 | 婷婷国产在线综合| www.欧美色图| 久久精品一区四区| 韩国v欧美v日本v亚洲v| 91精品国产美女浴室洗澡无遮挡| 亚洲欧美偷拍三级| 成人美女视频在线观看| 久久久久久久久久久久久女国产乱 | 国产裸体歌舞团一区二区| 8x8x8国产精品| 伊人色综合久久天天人手人婷| 成人免费看视频| 欧美激情自拍偷拍| 成人性生交大片免费看视频在线| 26uuu国产在线精品一区二区| 老司机精品视频在线| 日韩欧美一区在线| 久久精品国产亚洲a| 91.成人天堂一区| 蜜桃av一区二区| 精品国产一区二区精华| 麻豆传媒一区二区三区| 欧美大肚乱孕交hd孕妇| 国内偷窥港台综合视频在线播放| 日韩午夜在线影院| 精品一区二区三区免费观看 | 欧美日韩精品一二三区| 性做久久久久久久免费看| 9191国产精品| 精品亚洲欧美一区| 亚洲国产精品高清| 91丨porny丨最新| 亚洲一级片在线观看| 欧美裸体bbwbbwbbw| 青青草国产精品97视觉盛宴| 欧美大度的电影原声| 国产福利一区二区| 亚洲色欲色欲www在线观看| 91久久精品国产91性色tv| 日日夜夜一区二区| 久久久久久久久一| 91在线一区二区三区| 性久久久久久久久| 久久久久久一二三区| 97久久超碰国产精品| 亚洲国产中文字幕| 26uuu色噜噜精品一区| 成人久久视频在线观看| 亚洲成人综合网站| 国产日韩高清在线| 欧美视频一区二区三区四区 | 日本欧美肥老太交大片| 久久久噜噜噜久噜久久综合| 在线看国产一区二区| 免费成人性网站| 亚洲人精品一区| 日韩精品影音先锋| 色一情一乱一乱一91av| 国产精品一区二区你懂的| 综合网在线视频| 日韩亚洲欧美在线观看| 91色婷婷久久久久合中文| 日韩不卡免费视频| 中文字幕字幕中文在线中不卡视频| 欧美精品乱码久久久久久| 高清国产一区二区| 热久久国产精品| 亚洲免费大片在线观看| 国产日产亚洲精品系列| 91精品国产综合久久久久久久久久 | 自拍偷拍欧美激情| 精品美女被调教视频大全网站| 一本色道综合亚洲| 国产成人免费在线| 琪琪久久久久日韩精品| 一级中文字幕一区二区| 国产精品欧美一区喷水| 欧美不卡一区二区三区四区| 91成人免费网站| av成人动漫在线观看| 久草在线在线精品观看| 亚洲一区二区三区美女| 国产精品不卡一区二区三区| 精品电影一区二区| 日韩无一区二区| 在线亚洲精品福利网址导航| 99re热视频这里只精品| 成人app网站| 国产精品亚洲一区二区三区妖精 | 色综合久久九月婷婷色综合| 国产成人精品免费在线| 国内成人免费视频| 美女精品自拍一二三四| 秋霞国产午夜精品免费视频| 天堂在线亚洲视频| 亚洲777理论| 日韩av不卡在线观看| 日韩中文字幕区一区有砖一区 | 亚洲欧美日韩综合aⅴ视频| 欧美极品xxx| 国产精品你懂的在线| 中文字幕免费在线观看视频一区| 久久精品男人天堂av| 国产午夜精品美女毛片视频| 国产亚洲欧洲一区高清在线观看| 国产日韩成人精品| 中文字幕在线一区免费| 亚洲免费在线视频一区 二区| 日韩理论片在线| 亚洲乱码一区二区三区在线观看| 一区二区在线免费观看| 亚洲精品欧美专区| 亚洲高清免费视频| 日韩**一区毛片| 国产美女在线精品| 不卡视频一二三| 在线欧美日韩精品| 欧美日韩在线不卡| 精品美女被调教视频大全网站| 久久精品一二三| 亚洲免费观看视频| 视频一区中文字幕国产| 久久99国产精品免费网站| 国产一区二区精品在线观看| 丁香天五香天堂综合| 色视频成人在线观看免| 制服丝袜亚洲网站| 亚洲国产精品ⅴa在线观看| 亚洲精选一二三| 奇米在线7777在线精品| 国产一区二区看久久| 色综合久久综合| 欧美xxxxxxxxx| 亚洲欧美另类久久久精品| 天天综合网 天天综合色| 国产美女主播视频一区| 欧美综合亚洲图片综合区| 精品剧情在线观看| 一区二区三区在线播放| 久草精品在线观看| 欧美中文字幕久久| 久久久精品黄色| 五月婷婷久久丁香| 成人一道本在线| 欧美一区日本一区韩国一区| 中文字幕av一区二区三区高| 亚洲国产成人精品视频| 丁香六月久久综合狠狠色| 欧美日韩一级黄| 亚洲视频小说图片| 韩日精品视频一区| 在线播放国产精品二区一二区四区| 久久久精品免费免费| 首页国产丝袜综合| 91国产免费观看| 久久午夜老司机| 免费视频最近日韩| 欧美性欧美巨大黑白大战| 久久久久久久久久久电影| 日韩国产在线观看| 在线观看av一区| 亚洲色图清纯唯美| 大胆欧美人体老妇| 久久在线观看免费| 老司机免费视频一区二区| 欧美日韩一卡二卡| 亚洲免费视频中文字幕| 成人免费高清在线| 久久久久久久网| 久久电影国产免费久久电影 | 国产亚洲成aⅴ人片在线观看| 午夜久久久影院| 欧美影院午夜播放| 亚洲人成网站在线| 一本色道久久综合狠狠躁的推荐| 国产婷婷一区二区| 国产精品99久久久久久久女警 | 精品卡一卡二卡三卡四在线| 午夜精品福利久久久| 欧美综合在线视频| 亚洲精品中文在线影院| 成年人网站91| 最新国产成人在线观看| 99re在线精品| 一区二区三区在线高清| 欧美午夜一区二区三区 | 91国模大尺度私拍在线视频| 亚洲男人的天堂一区二区| 日本电影亚洲天堂一区| 亚洲一区在线免费观看|