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

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

?? ch08.htm

?? 24小時精通VC
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
	of messages sent to the <TT>CMouseTstView</TT> class will be displayed in the Message
	list box.<BR>
	<BR>
	2. Select the <TT>WM_LBUTTONDOWN</TT> message from the Message list box, and click
	the Add Function button.<BR>
	<BR>
	3. Repeat step 2 for the <TT>WM_RBUTTONDOWN</TT>, <TT>WM_LBUTTONDBLCLK</TT>, and
	<TT>WM_RBUTTONDBLCLK</TT> messages.<BR>
	<BR>
	4. Click OK to close ClassWizard.
</DL>

<P>Edit the message-handling functions so they look like the function provided in
Listing 8.5. You must remove some source code provided by ClassWizard in each function.
<H4><FONT COLOR="#000077">TYPE: Listing 8.5. The four mouse-handling functions for
CMouseTstView.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CMouseTstView::OnLButtonDblClk(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Left Button Double Click&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnLButtonDown(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Left Button Down&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnRButtonDblClk(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Right Button Double Click&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
<TT>}</TT>

<TT>void CMouseTstView::OnRButtonDown(UINT nFlags, CPoint point)</TT>
<TT>{</TT>
<TT>    m_ptMouse = point;</TT>
<TT>    m_szDescription = &quot;Right Button Down&quot;;</TT>
<TT>    InvalidateRect( NULL );</TT>
</FONT></PRE>
<P><TT>}</TT> Each of the message-handling functions in Listing 8.5 stores the position
of both the mouse event and a text string that describes the event. Each function
then invalidates the view rectangle. The next step is to use the <TT>CMouseTstView::OnDraw</TT>
function to display the event. Edit <TT>CMouseTstView::OnDraw</TT> so it contains
the source code in Listing 8.6. Remove any existing source code provided by AppWizard.
<H4><FONT COLOR="#000077">TYPE: Listing 8.6. The OnDraw member function for CMouseTstView.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>void CMouseTstView::OnDraw(CDC* pDC)</TT>
<TT>{</TT>
<TT>    pDC-&gt;TextOut( m_ptMouse.x, m_ptMouse.y, m_szDescription );</TT>
</FONT></PRE>
<P><TT>}</TT> The <TT>OnDraw</TT> member function uses <TT>TextOut</TT> to display
the previously saved event message. The <TT>CPoint</TT> object, <TT>m_ptMouse</TT>,
was used to store the mouse event's position. A <TT>CPoint</TT> object has two member
variables, <TT>x</TT> and <TT>y</TT>, which are used to plot a point in a window.
<H3><FONT COLOR="#000077"><B>Running MouseTst</B></FONT></H3>
<P>Build and run MouseTst, then click the main window's client area. A message is
displayed whenever you click the left or right mouse button.</P>
<P>Figure 8.4 shows the MouseTst program after a mouse button has been clicked.</P>
<P><A NAME="04"></A><A HREF="04.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch08/04.htm"><B>Figure 8.4.</B></A> <I><BR>
The MouseTst program displaying a mouse event.</I>
<H2><FONT COLOR="#000077"><B>What Are MFC Base Classes?</B></FONT></H2>
<P>The MFC class library includes a large number of classes well suited for Windows
programming. Most of these classes are derived from <TT>CObject</TT>, a class that
is at the root of the MFC class hierarchy. In addition, any class that represents
a window or control is derived from the <TT>CWnd</TT> class, which handles basic
functions that are common to all windows.


<BLOCKQUOTE>
	<P>
<HR>
<B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>The <TT>CObject</TT>
	and <TT>CWnd</TT> classes use virtual functions, which enable your program to access
	general-purpose functions through a base pointer. This enables you to easily use
	any object that is derived from <TT>CObject</TT> or <TT>CWnd</TT> when interacting
	with the MFC framework. 
<HR>


</BLOCKQUOTE>

<H3><FONT COLOR="#000077"><B>The <TT>CObject</TT> Base Class</B></FONT></H3>
<P>Almost every class used in an MFC program is derived from <TT>CObject</TT>. The
<TT>CObject</TT> class provides four types of services:

<UL>
	<LI>Diagnostic memory management provides diagnostic messages when memory leaks are
	detected. These leaks are often caused by failing to free objects that have been
	dynamically created.<BR>
	<BR>
	
	<LI>Dynamic creation support uses the <TT>CRuntimeClass</TT> to enable objects to
	be created at runtime. This is different from creating objects dynamically using
	the <TT>new</TT> operator.<BR>
	<BR>
	
	<LI>Serialization support enables an object to be stored and loaded in an object-oriented
	fashion. Serialization is discussed in Hour 22, &quot;Serialization.&quot;<BR>
	<BR>
	
	<LI>Runtime class information is used by the MFC class library to provide diagnostic
	information when errors are discovered in your program. Runtime class information
	is also used when you're serializing objects to or from storage.
</UL>

<H3><FONT COLOR="#000077"><B>The <TT>CWnd</TT> Base Class</B></FONT></H3>
<P>The <TT>CWnd</TT> class is derived from <TT>CObject</TT> and adds a great deal
of functionality that is shared by all windows in an MFC program. This also includes
dialog boxes and controls, which are just specialized versions of windows. Figure
8.5 shows some of the major MFC classes derived from <TT>CWnd</TT>.</P>
<P><A NAME="05"></A><A HREF="05.htm" tppabs="http://www.mcp.com/824169600/0-672/0-672-31242-5/ch08/05.htm"><B>Figure 8.5.</B> </A><I><BR>
Some of the major MFC classes derived from <TT>CWnd</TT>.</I></P>
<P>The <TT>CWnd</TT> class defines functions that can be applied to any <TT>CWnd</TT>
object, including objects that are instances of classes derived from <TT>CWnd</TT>.
As first shown in Hour 5, &quot;Button Controls,&quot; to set the caption or title
for any window, including controls, you can use the <TT>CWnd::SetWindowText</TT>
function.</P>
<P>Almost every significant object in an MFC program is a <TT>CObject</TT> instance.
This enables you to take advantage of the MFC support for discovering many common
memory leaks and other types of programming errors. The <TT>CObject</TT> class also
declares functions that can be used to provide diagnostic dumps during runtime and
support for serialization. Serialization is discussed in Hour 22.</P>
<P>Every window in an MFC program is a <TT>CWnd</TT> object. <TT>CWnd</TT> is derived
from <TT>CObject</TT> so it has all the <TT>CObject</TT> functionality built in.
Using the <TT>CWnd</TT> class to handle all controls and windows in your program
enables you to take advantage of polymorphism; the <TT>CWnd</TT> class provides all
the general window functions for all types of windows. This means you don't need
to know exactly what type of control or window is accessed through a <TT>CWnd</TT>
pointer in many cases.
<H3><FONT COLOR="#000077"><B>An Example Using the <TT>CObject</TT> and <TT>CWnd</TT>
Base Classes</B></FONT></H3>
<P>The <TT>CObject</TT> and <TT>CWnd</TT> classes are used in different ways. The
<TT>CObject</TT> class is normally used as a base class when you create your own
classes. The <TT>CWnd</TT> class is often passed as a function parameter or return
value and is used as a generic pointer to any type of window in an MFC program.</P>
<P>In this section, you create a sample console mode project that demonstrates how
the <TT>CObject</TT> class is used. To start the sample, create a new console mode
project named Runtime. In addition, configure the project so that it uses the MFC
class library by following these steps:

<DL>
	<DD>1. Select Settings from the Project menu. This opens the Project Settings dialog
	box.<BR>
	<BR>
	2. Click the General tab.<BR>
	<BR>
	3. Select Use MFC in a Shared DLL from the Microsoft Foundation Classes combo box.<BR>
	<BR>
	4. Close the dialog box by clicking OK.
</DL>

<H4><FONT COLOR="#000077">Using CObject as a Base Class</FONT></H4>
<P>The <TT>CObject</TT> class is always used as a base class; there isn't really
anything that can be done with a plain <TT>CObject</TT>. When used as a base class,
the <TT>CObject</TT> class provides a great deal of basic functionality to a class.
You can control the amount of functionality provided by <TT>CObject</TT> by using
macros in the derived class's declaration and definition files.</P>
<P>Four different levels of support are offered by <TT>CObject</TT> to its derived
classes:

<UL>
	<LI>Basic support with memory leak detection requires no macros.<BR>
	<BR>
	
	<LI>Support for runtime class identification requires the use of the <TT>DECLARE_DYNAMIC</TT>
	macro in the class declaration and the <TT>IMPLEMENT_DYNAMIC</TT> macro in the class
	definition.<BR>
	<BR>
	
	<LI>Support for dynamic object creation requires the use of the <TT>DECLARE_DYNCREATE</TT>
	macro in the class declaration and the <TT>IMPLEMENT_DYNCREATE</TT> macro in the
	class definition. The use of dynamic object creation is discussed later in this hour.<BR>
	<BR>
	
	<LI>Serialization support requires the use of the <TT>DECLARE_SERIAL</TT> macro in
	the class declaration and the <TT>IMPLEMENT_SERIAL</TT> macro in the class definition.
	The use of serialization is discussed in Hour 22.
</UL>

<P>Each of the <TT>CObject</TT> macros is used in a similar way. All <TT>DECLARE</TT>
macros have one parameter--the name of the class. The <TT>IMPLEMENT</TT> macros generally
take two parameters--the name of the class and the name of the immediate base class.
<TT>IMPLEMENT_SERIAL</TT> is an exception because it requires three parameters, as
discussed in Hour 22.</P>
<P>Listing 8.7 is the class declaration for <TT>CMyObject</TT>, a simple class that
is derived from <TT>CObject</TT>. The <TT>CMyObject</TT> class supports dynamic creation,
so it includes the <TT>DECLARE_DYNCREATE</TT> macro.
<H4><FONT COLOR="#000077">TYPE: Listing 8.7. The CMyObject class declaration, using
CObject as a base class.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>class CMyObject : public CObject</TT>
<TT>{</TT>
<TT>    DECLARE_DYNCREATE( CMyObject );</TT>
<TT>// Constructor</TT>
<TT>public:</TT>
<TT>    CMyObject();</TT>
<TT>//Attributes</TT>
<TT>public:</TT>
<TT>    void Set( const CString&amp; szName );</TT>
<TT>    CString Get() const;</TT>
<TT>//Implementation</TT>
<TT>private:</TT>
<TT>    CString m_szName;</TT>
</FONT></PRE>
<P><TT>};</TT> Save the source code from Listing 8.7 in the Runtime project directory
as <TT>MyObj.h</TT>. It's just an <TT>include</TT> file, so don't add it to the project.</P>
<P>The source code for the <TT>CMyObject</TT> member functions is provided in Listing
8.8. Save this source code as <TT>MyObj.cpp</TT> and add it to the Runtime project.
This source file contains the <TT>IMPLEMENT_DYNCREATE</TT> macro that matches the
<TT>DECLARE_DYNCREATE</TT> macro from the class declaration.
<H4><FONT COLOR="#000077">TYPE: Listing 8.8. Member functions for the CMyObject class.</FONT></H4>
<PRE><FONT COLOR="#0066FF"><TT>#include &lt;afx.h&gt;</TT>
<TT>#include &quot;MyObj.h&quot;</TT>
<TT>IMPLEMENT_DYNCREATE( CMyObject, CObject );</TT>
<TT>CMyObject::CMyObject()</TT>
<TT>{</TT>
<TT>}</TT>
<TT>void CMyObject::Set( const CString&amp; szName )</TT>
<TT>{</TT>
<TT>    m_szName = szName;</TT>
<TT>}</TT>
<TT>CString CMyObject::Get() const</TT>
<TT>{</TT>
<TT>    return m_szName;</TT>
</FONT></PRE>
<P><TT>}</TT>


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一区二区三区美女视频| 一区二区理论电影在线观看| 91麻豆国产自产在线观看| 婷婷六月综合网| 国产精品乱码一区二区三区软件| 欧美精品电影在线播放| 99在线精品视频| 国产乱人伦偷精品视频不卡| 夜夜操天天操亚洲| 久久久久久久av麻豆果冻| 欧美日韩国产精选| 色美美综合视频| 成人一区在线看| 激情欧美一区二区| 美日韩一级片在线观看| 一区2区3区在线看| **性色生活片久久毛片| 国产日韩欧美一区二区三区综合| 91精品国产品国语在线不卡 | 国产高清精品在线| 蜜臀av国产精品久久久久| 亚洲最色的网站| 亚洲另类一区二区| 国产精品乱码一区二区三区软件| 久久久久久久久久久久久久久99| 日韩你懂的电影在线观看| 91麻豆精品久久久久蜜臀| 欧美中文字幕一区二区三区 | 91精彩视频在线观看| 99免费精品在线观看| jlzzjlzz亚洲女人18| 精品亚洲porn| 国模大尺度一区二区三区| 麻豆国产精品一区二区三区| 热久久免费视频| 秋霞午夜鲁丝一区二区老狼| 人人精品人人爱| 麻豆成人免费电影| 蜜桃av一区二区三区电影| 蜜桃精品视频在线观看| 蜜桃视频一区二区三区在线观看| 日韩av成人高清| 日本中文在线一区| 久久国内精品自在自线400部| 麻豆一区二区在线| 六月丁香婷婷色狠狠久久| 国产在线不卡一区| 成人免费视频播放| 91麻豆免费视频| 欧美日韩亚洲国产综合| 欧美区在线观看| 日韩视频免费直播| 亚洲精品一区二区三区四区高清| 久久先锋资源网| 国产精品区一区二区三| 亚洲欧美日韩人成在线播放| 亚洲综合999| 理论电影国产精品| 国产成人8x视频一区二区| 99精品视频一区二区三区| 欧美午夜精品久久久久久超碰| 欧美日韩精品电影| 精品国精品国产| 国产精品美女久久久久久| 一区二区三区加勒比av| 日本女优在线视频一区二区| 国产成人h网站| 欧美丝袜自拍制服另类| 欧美成人一级视频| 国产精品免费丝袜| 亚洲动漫第一页| 激情综合色综合久久综合| 99久久精品免费看国产| 7777精品伊人久久久大香线蕉超级流畅| 欧美成人a在线| 日韩理论电影院| 日韩成人免费看| 成人小视频在线观看| 欧美老肥妇做.爰bbww| 国产日韩欧美精品电影三级在线| 亚洲激情网站免费观看| 美日韩黄色大片| 91视频在线观看免费| 欧美军同video69gay| 欧美极品aⅴ影院| 亚洲大片精品永久免费| 国产成人无遮挡在线视频| 欧美三级电影在线看| 国产欧美日韩综合| 日韩高清中文字幕一区| 99久久精品免费| www精品美女久久久tv| 亚洲一区二区av在线| 丁香天五香天堂综合| 制服.丝袜.亚洲.另类.中文| 成人免费在线播放视频| 久久99精品久久久久久动态图| 一本色道久久综合亚洲精品按摩| 精品成人a区在线观看| 亚洲在线视频免费观看| 成人爱爱电影网址| 久久久午夜精品| 日韩电影在线一区二区三区| 91免费视频观看| 久久精品综合网| 久久99精品久久只有精品| 欧美又粗又大又爽| 中文字幕一区二区三区不卡 | 国产欧美一区二区精品性色 | 日韩一级免费一区| 亚洲精品成人天堂一二三| 风流少妇一区二区| 欧美xxxxx牲另类人与| 丝袜美腿亚洲色图| 在线视频你懂得一区二区三区| 国产精品久久福利| 国产乱码精品一区二区三区五月婷| 777午夜精品视频在线播放| 亚洲精品久久7777| 91香蕉视频黄| 成人欧美一区二区三区小说| 国产91丝袜在线播放0| 久久久噜噜噜久噜久久综合| 精品一区二区三区免费观看| 日韩一区二区在线看| 午夜精品在线看| 欧美欧美欧美欧美首页| 亚洲国产精品一区二区久久恐怖片| 91免费观看在线| 综合激情网...| 91激情五月电影| 夜夜操天天操亚洲| 欧美日韩国产天堂| 奇米一区二区三区av| 日韩精品一区二区在线| 久久丁香综合五月国产三级网站| 日韩一区二区免费高清| 欧美a级理论片| 精品欧美一区二区久久| 国产一区二区三区蝌蚪| 久久精品视频在线看| 成人综合婷婷国产精品久久免费| 国产欧美在线观看一区| 成人性生交大合| 亚洲精品乱码久久久久久久久| 色综合久久天天| 亚洲不卡一区二区三区| 欧美一级久久久久久久大片| 精品一区二区三区免费播放| 欧美国产欧美综合| 91老司机福利 在线| 肉色丝袜一区二区| 欧美va在线播放| 国产91高潮流白浆在线麻豆| 最新国产成人在线观看| 在线亚洲免费视频| 日本亚洲最大的色成网站www| 2023国产一二三区日本精品2022| 懂色av一区二区三区免费看| 亚洲三级久久久| 欧美一区二区成人6969| 国产成a人亚洲| 亚洲伊人伊色伊影伊综合网| 51精品国自产在线| 成人深夜在线观看| 日韩影视精彩在线| 久久精品亚洲乱码伦伦中文| 91亚洲精品久久久蜜桃| 免费人成精品欧美精品| 欧美激情艳妇裸体舞| 91精品福利在线| 国产麻豆精品久久一二三| 伊人婷婷欧美激情| 精品日韩99亚洲| 91在线视频播放地址| 日韩黄色小视频| 国产精品不卡视频| 日韩亚洲电影在线| av午夜一区麻豆| 久久成人久久爱| 亚洲美女视频一区| 精品国产乱码久久久久久蜜臀| 97国产精品videossex| 麻豆国产精品一区二区三区| 亚洲美女屁股眼交3| 久久综合成人精品亚洲另类欧美| 色噜噜狠狠色综合中国| 国产一区 二区 三区一级| 亚洲第四色夜色| 中文字幕综合网| 久久久影院官网| 4438x成人网最大色成网站| 91视频91自| 国产精品一二三四区| 日产国产高清一区二区三区| 亚洲女同女同女同女同女同69| 2023国产精华国产精品| 欧美剧情电影在线观看完整版免费励志电影 | 日韩欧美国产电影| 色哦色哦哦色天天综合|