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

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

?? ch20.htm

?? 21天學會VC的英文版
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
		</TD>		<TD ALIGN="LEFT">Disabled		</TD>		<TD ALIGN="LEFT">Checked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">Edit Box		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_EMSG		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Disabled		</TD>		<TD ALIGN="LEFT">Checked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">Command Button		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_BSEND		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Caption		</TD>		<TD ALIGN="LEFT">S&amp;end		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Disabled		</TD>		<TD ALIGN="LEFT">Checked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">Static Text		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_STATIC		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Caption		</TD>		<TD ALIGN="LEFT">Sent:		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">List Box		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_LSENT		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Tab Stop		</TD>		<TD ALIGN="LEFT">Unchecked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Sort		</TD>		<TD ALIGN="LEFT">Unchecked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Selection		</TD>		<TD ALIGN="LEFT">None		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">Static Text		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_STATIC		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Caption		</TD>		<TD ALIGN="LEFT">Received:		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">List Box		</TD>		<TD ALIGN="LEFT">ID		</TD>		<TD ALIGN="LEFT">IDC_LRECVD		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Tab Stop		</TD>		<TD ALIGN="LEFT">Unchecked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Sort		</TD>		<TD ALIGN="LEFT">Unchecked		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">			<P>		</TD>		<TD ALIGN="LEFT">Selection		</TD>		<TD ALIGN="LEFT">None		</TD>	</TR></TABLE></P><P>Once you have the dialog designed, open the Class Wizard to attach variables tothe controls on the dialog, as specified in Table 20.3.</P><P><H4>TABLE 20.3. CONTROL VARIABLES.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Object</I></TD>		<TD ALIGN="LEFT"><I>Name</I></TD>		<TD ALIGN="LEFT"><I>Category</I></TD>		<TD ALIGN="LEFT"><I>Type</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_BCONNECT		</TD>		<TD ALIGN="LEFT">m_ctlConnect		</TD>		<TD ALIGN="LEFT">Control		</TD>		<TD ALIGN="LEFT">CButton		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_EMSG		</TD>		<TD ALIGN="LEFT">m_strMessage		</TD>		<TD ALIGN="LEFT">Value		</TD>		<TD ALIGN="LEFT">CString		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_ESERVNAME		</TD>		<TD ALIGN="LEFT">m_strName		</TD>		<TD ALIGN="LEFT">Value		</TD>		<TD ALIGN="LEFT">CString		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_ESERVPORT		</TD>		<TD ALIGN="LEFT">m_iPort		</TD>		<TD ALIGN="LEFT">Value		</TD>		<TD ALIGN="LEFT">int		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_LRECVD		</TD>		<TD ALIGN="LEFT">m_ctlRecvd		</TD>		<TD ALIGN="LEFT">Control		</TD>		<TD ALIGN="LEFT">CListBox		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_LSENT		</TD>		<TD ALIGN="LEFT">m_ctlSent		</TD>		<TD ALIGN="LEFT">Control		</TD>		<TD ALIGN="LEFT">CListBox		</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">IDC_RCLIENT		</TD>		<TD ALIGN="LEFT">m_iType		</TD>		<TD ALIGN="LEFT">Value		</TD>		<TD ALIGN="LEFT">int		</TD>	</TR></TABLE></P><P>So that you can reuse the Connect button to place the server application intolisten mode, you'll add a function to the clicked event message for both radio buttons,changing the text on the command button depending on which of the two is currentlyselected. To add this functionality to your application, add a function to the BN_CLICKEDevent message for the IDC_RCLIENT control ID, naming the function OnRType. Add thesame function to the BN_CLICKED event message for the IDC_RSERVER control ID. Editthis function, adding the code in Listing 20.1.</P><P><H4>LISTING 20.1. THE CSockDlg OnRType FUNCTION.</H4><PRE> 1: void CSockDlg::OnRType() 2: { 3:     // TODO: Add your control notification handler code here 4:     // Sync the controls with the variables 5:     UpdateData(TRUE); 6:     // Which mode are we in? 7:     if (m_iType == 0)    // Set the appropriate text on the button 8:         m_ctlConnect.SetWindowText(&quot;C&amp;onnect&quot;); 9:     else10:         m_ctlConnect.SetWindowText(&quot;&amp;Listen&quot;);11: }</PRE><P>Now, if you compile and run your application, you should be able to select oneand then the other of these two radio buttons, and the text on the command buttonshould change to reflect the part the application will play, as in Figure 20.5.</P><P><A HREF="javascript:popUp('20fig05.gif')"><B>FIGURE 20.5.</B></A><B> </B><I>Changingthe button text.</I></P><P><I></I><H3><A NAME="Heading11"></A>Inheriting from the CAsyncSocket Class</H3><P>So that you will be able to capture and respond to the socket events, you'll createyour own descendent class from CAsyncSocket. This class will need its own versionsof the event functions, as well as a means of passing this event to the dialog thatthe object will be a member of. So that you can pass each of these events to thedialog-class level, you'll add a pointer to the parent dialog class as a member variableof your socket class. You'll use this pointer to call event functions for each ofthe socket events that are member functions of the dialog, after checking to makesure that no errors have occurred (of course).</P><P>To create this class in your application, select Insert | New Class from the menu.In the New Class dialog, leave the class type with the default value of MFC Class.Enter a name for your class, such as CMySocket, and select CAsyncSocket from thelist of available base classes. This is all that you can specify on the New Classdialog, so click the OK button to add this new class to your application.</P><P>Once you have created the socket class, add a member variable to the class toserve as a pointer to the parent dialog window. Specify the variable type as CDialog*,the variable name as m_pWnd, and the access as private. You also need to add a methodto the class to set the pointer, so add a member function to your new socket class.Specify the function type as void, the declaration as SetParent(CDialog* pWnd), andthe access as public. Edit this new function, setting the pointer passed as a parameterto the member variable pointer, as in Listing 20.2.</P><P><H4>LISTING 20.2. THE CMySocket SetParent FUNCTION.</H4><PRE> 1: void CMySocket::SetParent(CDialog *pWnd) 2: { 3:     // Set the member pointer 4:     m_pWnd = pWnd; 5: }</PRE><P>The only other thing that you need to do to your socket class is add the eventfunctions, which you'll use to call similarly named functions on the dialog class.To add a function for the OnAccept event function, add a member function to yoursocket class. Specify the function type as void, the function declaration as OnAccept(intnErrorCode), and the access as protected and check the virtual check box. Edit thisfunction, adding the code in Listing 20.3.</P><P><H4>LISTING 20.3. The CMySocket OnAccept FUNCTION.</H4><PRE> 1: void CMySocket::OnAccept(int nErrorCode) 2: { 3:     // Were there any errors? 4:     if (nErrorCode == 0) 5:         // No, call the dialog's OnAccept function 6:         ((CSockDlg*)m_pWnd)-&gt;OnAccept(); 7: }</PRE><P>Add similar functions to your socket class for the OnConnect, OnClose, OnReceive,and OnSend functions, calling same-named functions in the dialog class, which you'lladd later. After you've added all these functions, you'll need to include the headerfile for your application dialog in your socket class, as in line 7 of Listing 20.4.</P><P><H4>LISTING 20.4. THE CMySocket INCLUDES.</H4><PRE>1: // MySocket.cpp: implementation file2: //3:4: #include &quot;stdafx.h&quot;5: #include &quot;Sock.h&quot;6: #include &quot;MySocket.h&quot;7: #include &quot;SockDlg.h&quot;</PRE><P>Once you've added all the necessary event functions to your socket class, you'lladd a variable of your socket class to the dialog class. For the server functionality,you'll need two variables in the dialog class, one to listen for connection requestsand the other to be connected to the other application. Because you will need twosocket objects, add two member variables to the dialog class (CSockDlg). Specifythe type of both variables as your socket class (CMySocket) and the access for bothas private. Name one variable m_sListenSocket, to be used for listening for connectionrequests, and the other m_sConnectSocket, to be used for sending messages back andforth.</P><P>Once you've added the socket variables, you'll add the initialization code forall the variables. As a default, set the application type to client, the server nameas loopback, and the port to 4000. Along with these variables, you'll set the parentdialog pointers in your two socket objects so that they point to the dialog class.You can do this by adding the code in Listing 20.5 to the OnInitDialog function inthe dialog class.</P><BLOCKQUOTE>	<P><HR><STRONG>NOTE:</STRONG> The computer name loopback is a special name used in the TCP/IP network	protocol to indicate the computer you are working on. It's an internal computer name	that is resolved to the network address 127.0.0.1. This is a computer name and address	that is commonly used by applications that need to connect to other applications	running on the same computer.<HR></BLOCKQUOTE><H4>LISTING 20.5. THE CSockDlg OnInitDialog FUNCTION.</H4><PRE> 1: BOOL CSockDlg::OnInitDialog() 2: { 3:     CDialog::OnInitDialog(); 4: 5:     // Add &quot;About...&quot; menu item to system menu. 6:...26:     SetIcon(m_hIcon, FALSE);        // Set small icon27:28:     // TODO: Add extra initialization here29:     // Initialize the control variables30:     m_iType = 0;31:     m_strName = &quot;loopback&quot;;32:     m_iPort = 4000;33:     // Update the controls34:     UpdateData(FALSE);35:     // Set the socket dialog pointers36:     m_sConnectSocket.SetParent(this);37:     m_sListenSocket.SetParent(this);38:39:     return TRUE;  // return TRUE  unless you set the focus to a 	         &Acirc;control40: }</PRE><H3><A NAME="Heading12"></A>Connecting the Application</H3><P>When the user clicks the Connect button, you'll disable all the top controls onthe dialog. At this point, you don't want the user to think that she is able to changethe settings of the computer that she's connecting to or change how the applicationis listening. You'll call the Create function on the appropriate socket variable,depending on whether the application is running as the client or server. Finally,you'll call either the Connect or Listen function to initiate the application's sideof the connection. To add this functionality to your application, open the ClassWizard and add a function to the BN_CLICKED event message for the Connect button(ID IDC_BCONNECT). Edit this function, adding the code in Listing 20.6.</P><P><H4>LISTING 20.6. The CSockDlg OnBconnect FUNCTION.</H4><PRE> 1: void CSockDlg::OnBconnect() 2: { 3:     // TODO: Add your control notification handler code here 4:     // Sync the variables with the controls 5:     UpdateData(TRUE); 6:     // Disable the connection and type controls 7:     GetDlgItem(IDC_BCONNECT)-&gt;EnableWindow(FALSE); 8:     GetDlgItem(IDC_ESERVNAME)-&gt;EnableWindow(FALSE); 9:     GetDlgItem(IDC_ESERVPORT)-&gt;EnableWindow(FALSE);10:     GetDlgItem(IDC_STATICNAME)-&gt;EnableWindow(FALSE);11:     GetDlgItem(IDC_STATICPORT)-&gt;EnableWindow(FALSE);12:     GetDlgItem(IDC_RCLIENT)-&gt;EnableWindow(FALSE);13:     GetDlgItem(IDC_RSERVER)-&gt;EnableWindow(FALSE);14:     GetDlgItem(IDC_STATICTYPE)-&gt;EnableWindow(FALSE);15:     // Are we running as client or server?16:     if (m_iType == 0)17:     {18:         // Client, create a default socket19:         m_sConnectSocket.Create();20:         // Open the connection to the server21:         m_sConnectSocket.Connect(m_strName, m_iPort);22:     }23:     else24:     {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久这里只有精品首页| 久久成人羞羞网站| 成人免费视频网站在线观看| 精品国产91洋老外米糕| 国产一区二三区| 国产精品蜜臀在线观看| 成人免费av网站| 成人动漫一区二区| 日本色综合中文字幕| 精品国产91亚洲一区二区三区婷婷| 欧美日韩电影在线| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 色婷婷久久久综合中文字幕| 亚洲一区二区三区在线| 欧美一区二区观看视频| 成人精品免费网站| 91视视频在线观看入口直接观看www | 日韩久久久久久| 99久久精品免费观看| 免费久久精品视频| 亚洲精品国产a久久久久久| 欧美久久久影院| 99精品在线观看视频| 91免费版pro下载短视频| 欧美午夜精品久久久| 国产宾馆实践打屁股91| 奇米影视一区二区三区小说| 狠狠色伊人亚洲综合成人| 日韩电影在线一区| 国产一区二区视频在线| 成人av资源网站| 欧美精品v日韩精品v韩国精品v| 亚洲精品一区二区三区四区高清 | 日韩美女主播在线视频一区二区三区 | 欧美区视频在线观看| 日韩久久精品一区| 亚洲欧美另类图片小说| 精品乱人伦小说| 69久久99精品久久久久婷婷| 欧美最猛性xxxxx直播| 91黄色免费版| 在线观看亚洲a| 久久亚洲一区二区三区明星换脸| 国产精品美女久久久久aⅴ国产馆| 一区二区三区在线观看网站| 一区二区中文视频| 国产精品对白交换视频| 国产精品拍天天在线| 天天综合天天做天天综合| 日韩美女视频一区二区| 亚洲精品日韩一| 精品一区二区免费| 国产精品77777竹菊影视小说| 久久狠狠亚洲综合| 欧美午夜不卡在线观看免费| 国产欧美日韩视频在线观看| 国产蜜臀97一区二区三区| 天天综合天天综合色| 色婷婷国产精品综合在线观看| 欧美va天堂va视频va在线| 亚洲制服丝袜av| 99在线视频精品| 在线观看一区日韩| 亚洲欧洲精品成人久久奇米网| 久久99精品一区二区三区三区| 欧美日韩精品久久久| 亚洲日本电影在线| 成人av网在线| 国产精品三级电影| 国产.精品.日韩.另类.中文.在线.播放| 91精品婷婷国产综合久久 | 日本欧美肥老太交大片| 色妹子一区二区| 中文字幕一区二区视频| 国产高清不卡二三区| 精品1区2区在线观看| 久久国产乱子精品免费女| 日韩女优视频免费观看| 精品一区二区综合| 精品欧美一区二区久久| 国内精品不卡在线| 中文一区二区完整视频在线观看| 欧美极品xxx| 风间由美一区二区三区在线观看| 中文字幕欧美三区| 波多野结衣一区二区三区| 综合久久综合久久| 色婷婷久久一区二区三区麻豆| 一区二区三区在线高清| 欧美性猛交xxxx乱大交退制版 | 欧美成人三级电影在线| 精品无人码麻豆乱码1区2区| 精品成人a区在线观看| 国产在线观看一区二区| 国产精品久久久久影视| 99精品视频在线播放观看| 一区二区三区欧美| 欧美一级理论片| 亚洲三级在线免费| 欧美午夜不卡视频| 久久国产日韩欧美精品| 国产精品天干天干在观线| 91视频国产资源| 婷婷久久综合九色国产成人| 精品国产91洋老外米糕| 99久久国产综合精品色伊| 天天综合色天天综合色h| 精品成人a区在线观看| 99在线热播精品免费| 日韩精品免费专区| 欧美日韩国产精品成人| 极品销魂美女一区二区三区| 亚洲同性同志一二三专区| 欧美精品第一页| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 亚洲亚洲人成综合网络| 色天天综合久久久久综合片| 免费成人结看片| 亚洲你懂的在线视频| 精品国产免费一区二区三区香蕉| 99久久99久久免费精品蜜臀| 天堂va蜜桃一区二区三区漫画版| 国产婷婷色一区二区三区在线| 国产美女视频91| 亚洲国产成人高清精品| 国产女同性恋一区二区| 欧美一区在线视频| 99国产精品99久久久久久| 国产一区二区三区久久悠悠色av| 亚洲国产sm捆绑调教视频 | 97aⅴ精品视频一二三区| 日韩成人一区二区三区在线观看| 欧美激情中文字幕| 精品国产露脸精彩对白| 欧美天堂一区二区三区| 91丝袜美女网| 国v精品久久久网| 狠狠色狠狠色综合系列| 日本欧美一区二区| 亚洲一区在线观看免费| 亚洲色图另类专区| 亚洲欧美在线另类| 欧美国产日韩在线观看| 国产视频不卡一区| 久久久久一区二区三区四区| voyeur盗摄精品| 国产美女视频一区| 国产精品一区二区男女羞羞无遮挡 | 欧美大胆人体bbbb| 69堂国产成人免费视频| 欧美高清视频不卡网| 欧美日韩在线亚洲一区蜜芽| 麻豆高清免费国产一区| 国产精品天美传媒沈樵| 国产欧美精品一区二区色综合朱莉 | 日韩美女一区二区三区| 欧美精品一二三区| 欧美日韩国产另类一区| 欧美精品一二三| 日韩视频免费直播| 2021久久国产精品不只是精品| 欧美变态tickling挠脚心| 精品毛片乱码1区2区3区| 日韩精品一区二区三区视频播放 | 国产69精品久久久久毛片| 国产美女久久久久| 成人激情av网| 99re视频这里只有精品| 在线亚洲人成电影网站色www| 色女孩综合影院| 91精品国产入口| 久久精品一区二区三区四区| 国产精品欧美一级免费| 亚洲在线视频网站| 日本欧美久久久久免费播放网| 精品一区二区国语对白| fc2成人免费人成在线观看播放| 色屁屁一区二区| 日韩一区二区在线免费观看| xf在线a精品一区二区视频网站| 欧美国产成人在线| 亚洲影视在线播放| 加勒比av一区二区| 91在线国产观看| 日韩精品资源二区在线| 国产欧美精品一区二区色综合朱莉| 亚洲精品午夜久久久| 久久成人久久爱| 91福利在线观看| xf在线a精品一区二区视频网站| 亚洲天堂精品视频| 免费在线成人网| 91在线丨porny丨国产| 日韩一区二区三区观看| 亚洲婷婷综合色高清在线| 日本在线不卡视频一二三区| 国产精品一区二区在线观看不卡| 在线日韩一区二区| 久久精品一区二区三区不卡| 视频一区二区不卡|