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

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

?? wtl for mfc programmers, part iv.mht

?? 大家知道wtl是window UI庫
?? MHT
?? 第 1 頁 / 共 5 頁
字號:
      <P>The parameters are:</P>
      <DL>
        <DT><CODE>bSaveAndValidate</CODE>=20
        <DD>Flag indicating which direction the data will be =
transferred.=20
        Passing <CODE>TRUE</CODE> transfers from the controls to the =
variables.=20
        Passing <CODE>FALSE</CODE> transfers from the variables to the =
controls.=20
        Note that the default for this parameter is <CODE>FALSE</CODE>, =
while=20
        the default for MFC's <CODE>UpdateData()</CODE> is =
<CODE>TRUE</CODE>.=20
        You can also use the symbols <CODE>DDX_SAVE</CODE> and=20
        <CODE>DDX_LOAD</CODE> (defined as <CODE>TRUE</CODE> and=20
        <CODE>FALSE</CODE> respectively) as the parameter, if you find =
that=20
        easier to remember.=20
        <DT><CODE>nCtlID</CODE>=20
        <DD>Pass -1 to update all controls. Otherwise, if you want to =
use DDX on=20
        only one control, pass the control's ID. </DD></DL>
      <P><CODE>DoDataExchange()</CODE> returns <CODE>TRUE</CODE> if the =
controls=20
      are updated successfully, or <CODE>FALSE</CODE> if not. There are =
two=20
      functions you can override in your dialog to handle errors. The =
first,=20
      <CODE>OnDataExchangeError()</CODE> is called if the data exchange =
fails=20
      for any reason. The default implementation in=20
      <CODE>CWinDataExchange</CODE> sounds a beep and sets focus to the =
control=20
      that caused the error. The other function is=20
      <CODE>OnDataValidateError()</CODE>, but we'll get to that in Part =
V when=20
      we cover DDV.</P>
      <H3><A name=3Dusingddx></A>Using DDX</H3>
      <P>Let's add a couple of variables to <CODE>CMainDlg</CODE> for =
use with=20
      DDX.</P><PRE><SPAN class=3Dcpp-keyword>class</SPAN> CMainDlg : =
<SPAN class=3Dcpp-keyword>public</SPAN> ...
{
<SPAN class=3Dcpp-comment>//...</SPAN>
    BEGIN_DDX_MAP(CMainDlg)
        DDX_CONTROL(IDC_EDIT, m_wndEdit)
        <B>DDX_TEXT(IDC_EDIT, m_sEditContents)
        DDX_INT(IDC_EDIT, m_nEditNumber)</B>
    END_DDX_MAP()
=20
<SPAN class=3Dcpp-keyword>protected</SPAN>:
    <SPAN class=3Dcpp-comment>// DDX variables</SPAN>
    CString m_sEditContents;
    <SPAN class=3Dcpp-keyword>int</SPAN>     m_nEditNumber;
};</PRE>
      <P>In the <I>OK</I> button handler, we first call=20
      <CODE>DoDataExchange()</CODE> to transfer the data from the edit =
control=20
      to the two variables we just added. We then show the results in =
the list=20
      control.</P><PRE>LRESULT CMainDlg::OnOK ( UINT uCode, <SPAN =
class=3Dcpp-keyword>int</SPAN> nID, HWND hWndCtl )
{
CString str;
=20
    <SPAN class=3Dcpp-comment>// Transfer data from the controls to =
member variables.</SPAN>
    <SPAN class=3Dcpp-keyword>if</SPAN> ( !DoDataExchange(<SPAN =
class=3Dcpp-keyword>true</SPAN>) )
        <SPAN class=3Dcpp-keyword>return</SPAN>;
=20
    m_wndList.DeleteAllItems();
=20
    m_wndList.InsertItem ( <SPAN class=3Dcpp-literal>0</SPAN>, _T(<SPAN =
class=3Dcpp-string>"DDX_TEXT"</SPAN>) );
    m_wndList.SetItemText ( <SPAN class=3Dcpp-literal>0</SPAN>, <SPAN =
class=3Dcpp-literal>1</SPAN>, m_sEditContents );
=20
    str.Format ( _T(<SPAN class=3Dcpp-string>"%d"</SPAN>), m_nEditNumber =
);
    m_wndList.InsertItem ( <SPAN class=3Dcpp-literal>1</SPAN>, _T(<SPAN =
class=3Dcpp-string>"DDX_INT"</SPAN>) );
    m_wndList.SetItemText ( <SPAN class=3Dcpp-literal>1</SPAN>, <SPAN =
class=3Dcpp-literal>1</SPAN>, str );
}</PRE>
      <P><IMG height=3D246 alt=3D" [DDX results - 5K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/ddxok.png" =
width=3D333=20
      align=3Dbottom border=3D0></P>
      <P>If you enter non-numerical text in the edit box, =
<CODE>DDX_INT</CODE>=20
      will fail and call <CODE>OnDataExchangeError()</CODE>.=20
      <CODE>CMainDlg</CODE> overrides <CODE>OnDataExchangeError()</CODE> =
to show=20
      a message box:</P><PRE><SPAN class=3Dcpp-keyword>void</SPAN> =
CMainDlg::OnDataExchangeError ( UINT nCtrlID, BOOL bSave )
{
CString str;
=20
    str.Format ( _T(<SPAN class=3Dcpp-string>"DDX error during exchange =
with control: %u"</SPAN>), nCtrlID );
    MessageBox ( str, _T(<SPAN =
class=3Dcpp-string>"ControlMania1"</SPAN>), MB_ICONWARNING );
    =20
    ::SetFocus ( GetDlgItem(nCtrlID) );
}</PRE>
      <P><IMG height=3D338 alt=3D" [DDX error msg - 7K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/ddxerror.png" =
width=3D372=20
      align=3Dbottom border=3D0></P>
      <P>As our last DDX example, let's add a check box to show the =
usage of=20
      <CODE>DDX_CHECK</CODE>:</P>
      <P><IMG height=3D265 alt=3D" [Msg checkbox - 6K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/msgchkbox.png" =
width=3D333=20
      align=3Dbottom border=3D0></P>
      <P>The variable used with <CODE>DDX_CHECK</CODE> is an <CODE><SPAN =

      class=3Dcpp-keyword>int</SPAN></CODE>, and can have the value 0, =
1, or 2,=20
      corresponding to the unchecked, checked, or indeterminate states. =
You can=20
      also use the constants <CODE>BST_UNCHECKED</CODE>,=20
      <CODE>BST_CHECKED</CODE>, and <CODE>BST_INDETERMINATE</CODE> =
instead of=20
      0-2. For check boxes that can only be checked or unchecked, you =
can treat=20
      the variable like a boolean.</P>
      <P>Here are the changes to make hook up the check box to =
DDX:</P><PRE><SPAN class=3Dcpp-keyword>class</SPAN> CMainDlg : <SPAN =
class=3Dcpp-keyword>public</SPAN> ...
{
<SPAN class=3Dcpp-comment>//...</SPAN>
    BEGIN_DDX_MAP(CMainDlg)
        DDX_CONTROL(IDC_EDIT, m_wndEdit)
        DDX_TEXT(IDC_EDIT, m_sEditContents)
        DDX_INT(IDC_EDIT, m_nEditNumber)
        <B>DDX_CHECK(IDC_SHOW_MSG, m_nShowMsg)</B>
    END_DDX_MAP()
=20
<SPAN class=3Dcpp-keyword>protected</SPAN>:
    <SPAN class=3Dcpp-comment>// DDX variables</SPAN>
    CString m_sEditContents;
    <SPAN class=3Dcpp-keyword>int</SPAN>     m_nEditNumber;
    <B><SPAN class=3Dcpp-keyword>int</SPAN>     m_nShowMsg;</B>
};</PRE>
      <P>At the end of <CODE>OnOK()</CODE>, we test =
<CODE>m_nShowMsg</CODE> to=20
      see if the check box was checked.</P><PRE><SPAN =
class=3Dcpp-keyword>void</SPAN> CMainDlg::OnOK ( UINT uCode, <SPAN =
class=3Dcpp-keyword>int</SPAN> nID, HWND hWndCtl )
{
    <SPAN class=3Dcpp-comment>// Transfer data from the controls to =
member variables.</SPAN>
    <SPAN class=3Dcpp-keyword>if</SPAN> ( !DoDataExchange(<SPAN =
class=3Dcpp-keyword>true</SPAN>) )
        <SPAN class=3Dcpp-keyword>return</SPAN>;
<SPAN class=3Dcpp-comment>//...</SPAN>
    <SPAN class=3Dcpp-keyword>if</SPAN> ( m_nShowMsg )
        MessageBox ( _T(<SPAN class=3Dcpp-string>"DDX =
complete!"</SPAN>), _T(<SPAN class=3Dcpp-string>"ControlMania1"</SPAN>), =

                     MB_ICONINFORMATION );
}</PRE>
      <P>The sample project has examples of using the other =
<CODE>DDX_*</CODE>=20
      macros as well.</P>
      <H2><A name=3Dhandlenotify></A>Handling Notifications from =
Controls</H2>
      <P>Handling notifications in WTL is similar to API-level =
programming. A=20
      control sends its parent a notification in the form of a=20
      <CODE>WM_COMMAND</CODE> or <CODE>WM_NOTIFY</CODE> message, and =
it's the=20
      parent's responsibility to handle it. A few other messages can be=20
      considered notifications, such as <CODE>WM_DRAWITEM</CODE>, which =
is sent=20
      when an owner-drawn control needs to be painted. The parent window =
can act=20
      on the message itself, or it can <I>reflect</I> the message back =
to the=20
      control. Reflection works as in MFC - the control is able to =
handle=20
      notifications itself, making the code self-contained and easier to =
move to=20
      other projects.</P>
      <H3><A name=3Dhandleinparent></A>Handing notifications in the =
parent</H3>
      <P>Notifications sent as <CODE>WM_NOTIFY</CODE> and=20
      <CODE>WM_COMMAND</CODE> contain various information. The =
parameters in a=20
      <CODE>WM_COMMAND</CODE> message contain the ID of the control =
sending the=20
      message, the <CODE>HWND</CODE> of the control, and the =
notification code.=20
      <CODE>WM_NOTIFY</CODE> messages have all those as well as a =
pointer to an=20
      <CODE>NMHDR</CODE> data structure. ATL and WTL have various =
message map=20
      macros for handling these notifications. I'll only be covering the =
WTL=20
      macros here, since this is a WTL article after all. Note that for =
all of=20
      these macros, you need to use <CODE>BEGIN_MSG_MAP_EX</CODE> in =
your=20
      message map, and #include atlcrack.h.</P>
      <H4>Message map macros</H4>
      <P>To handle a <CODE>WM_COMMAND</CODE> notification, use one of =
the=20
      <CODE>COMMAND_HANDLER_EX</CODE> macros:</P>
      <DL>
        <DT><CODE>COMMAND_HANDLER_EX(id, code, func)</CODE>=20
        <DD>Handles a notification from a particular control with a =
particular=20
        code.=20
        <DT><CODE>COMMAND_ID_HANDLER_EX(id, func)</CODE>=20
        <DD>Handles all notifications with a particular code, regardless =
of=20
        which control sends them.=20
        <DT><CODE>COMMAND_CODE_HANDLER_EX(code, func)</CODE>=20
        <DD>Handles all notifications from a particular control, =
regardless of=20
        the code.=20
        <DT><CODE>COMMAND_RANGE_HANDLER_EX(idFirst, idLast, func)</CODE> =

        <DD>Handles all notifications from controls whose IDs are in the =
range=20
        idFirst to idLast inclusive, regardless of the code.=20
        <DT><CODE>COMMAND_RANGE_CODE_HANDLER_EX(idFirst, idLast, code,=20
        func)</CODE>=20
        <DD>Handles all notifications from controls whose IDs are in the =
range=20
        idFirst to idLast inclusive, with a particular code. </DD></DL>
      <P>Examples:</P>
      <UL>
        <LI><CODE>COMMAND_HANDLER_EX(IDC_USERNAME, EN_CHANGE,=20
        OnUsernameChange)</CODE>: Handles <CODE>EN_CHANGE</CODE> when =
sent from=20
        the edit box with ID IDC_USERNAME.=20
        <LI><CODE>COMMAND_ID_HANDLER_EX(IDOK, OnOK)</CODE>: Handles all=20
        notifications sent from the control with ID IDOK.=20
        <LI><CODE>COMMAND_RANGE_CODE_HANDLER_EX(IDC_MONDAY, IDC_FRIDAY,=20
        BN_CLICKED, OnDayClicked)</CODE>: Handles all =
<CODE>BN_CLICKED</CODE>=20
        notifications from the controls with IDs in the range IDC_MONDAY =
to=20
        IDC_FRIDAY </LI></UL>
      <P>There are also macros for handling <CODE>WM_NOTIFY</CODE> =
messages.=20
      They work just like the macros above, but their names start with=20
      "<CODE>NOTIFY_</CODE>" instead of "<CODE>COMMAND_</CODE>".</P>
      <P>The prototype for a <CODE>WM_COMMAND</CODE> handler =
is:</P><PRE>  <SPAN class=3Dcpp-keyword>void</SPAN> func ( UINT uCode, =
<SPAN class=3Dcpp-keyword>int</SPAN> nCtrlID, HWND hwndCtrl );</PRE>
      <P><CODE>WM_COMMAND</CODE> notifications do not use a return =
value, so=20
      handlers don't either. The prototype for a <CODE>WM_NOTIFY</CODE> =
handler=20
      is:</P><PRE>  LRESULT func ( NMHDR* phdr );</PRE>
      <P>The return value of the handler is used as the message result. =
This is=20
      different from MFC, where the handler receives an =
<CODE>LRESULT*</CODE>=20
      and sets the message result through that variable. The =
notification code=20
      and the <CODE>HWND</CODE> of the control that sent the =
notification are=20
      available in the <CODE>NMHDR</CODE> struct, as the =
<CODE>code</CODE> and=20
      <CODE>hwndFrom</CODE> members. Just as in MFC, if the notification =
sends a=20
      struct that is not a plain <CODE>NMHDR</CODE>, your handler should =
cast=20
      the <CODE>phdr</CODE> parameter to the correct type.</P>
      <P>We'll add a notification handler to <CODE>CMainDlg</CODE> that =
handles=20
      <CODE>LVN_ITEMCHANGED</CODE> sent from the list control, and shows =
the=20
      currently-selected item in the dialog. We start by adding the =
message map=20
      macro and message handler:</P><PRE><SPAN =
class=3Dcpp-keyword>class</SPAN> CMainDlg : <SPAN =
class=3Dcpp-keyword>public</SPAN> ...
{
    BEGIN_MSG_MAP_EX(CMainDlg)
        NOTIFY_HANDLER_EX(IDC_LIST, LVN_ITEMCHANGED, OnListItemchanged)
    END_MSG_MAP()
=20
    LRESULT OnListItemchanged(NMHDR* phdr);
<SPAN class=3Dcpp-comment>//...</SPAN>
};</PRE>
      <P>Here's the message handler:</P><PRE>LRESULT =
CMainDlg::OnListItemchanged ( NMHDR* phdr )
{
NMLISTVIEW* pnmlv =3D (NMLISTVIEW*) phdr;
<SPAN class=3Dcpp-keyword>int</SPAN> nSelItem =3D =
m_wndList.GetSelectedIndex();
CString sMsg;
=20
    <SPAN class=3Dcpp-comment>// If no item is selected, show "none". =
Otherwise, show its index.</SPAN>
    <SPAN class=3Dcpp-keyword>if</SPAN> ( -<SPAN =
class=3Dcpp-literal>1</SPAN> =3D=3D nSelItem )
        sMsg =3D _T(<SPAN class=3Dcpp-string>"(none)"</SPAN>);
    <SPAN class=3Dcpp-keyword>else</SPAN>
        sMsg.Format ( _T(<SPAN class=3Dcpp-string>"%d"</SPAN>), nSelItem =
);
=20
    SetDlgItemText ( IDC_SEL_ITEM, sMsg );
    <SPAN class=3Dcpp-keyword>return<

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人a级免费电影| 亚洲国产精品视频| 欧美一区二区三区视频免费| av在线播放不卡| 久久69国产一区二区蜜臀| 亚洲资源在线观看| 中文字幕人成不卡一区| 久久久影院官网| 欧美xxxxxxxx| 欧美一级精品在线| 色欧美片视频在线观看| 成人手机电影网| 丁香桃色午夜亚洲一区二区三区| 亚洲综合色视频| **欧美大码日韩| 中文字幕亚洲一区二区av在线| 国产日韩成人精品| 国产精品女上位| 中文字幕一区免费在线观看| 国产精品视频九色porn| 国产精品久久久久久妇女6080| 久久九九国产精品| 国产亚洲欧美一区在线观看| 欧美激情在线看| 国产欧美精品日韩区二区麻豆天美| 欧美精品一区二区在线播放| 国产亚洲午夜高清国产拍精品| 久久久综合激的五月天| 国产精品另类一区| 一区二区三区日韩欧美精品| 亚洲国产乱码最新视频| 日韩成人免费电影| 久久福利资源站| 国产成人夜色高潮福利影视| 99视频一区二区| 欧美性猛交一区二区三区精品| 日韩午夜激情电影| 国产精品国产三级国产有无不卡 | 亚洲精品国产精华液| 夜夜精品视频一区二区 | 天堂一区二区在线| 美国毛片一区二区三区| 免费在线观看一区二区三区| 国精产品一区一区三区mba桃花 | a4yy欧美一区二区三区| 91免费观看视频在线| 欧美草草影院在线视频| 国产精品福利影院| 国产精品不卡一区二区三区| 奇米精品一区二区三区在线观看一| 精品一区二区三区在线播放| 成人免费观看视频| 日韩一区二区三区免费看| 国产精品毛片a∨一区二区三区| 一区二区三区欧美亚洲| 精品一区二区在线观看| 色偷偷一区二区三区| 精品裸体舞一区二区三区| 亚洲久草在线视频| 国产成人免费视频一区| 91.成人天堂一区| 国产精品不卡在线| 国产伦精品一区二区三区免费迷| 99在线视频精品| 欧美日韩国产精品自在自线| 欧美一区二区三区日韩视频| 欧美国产精品一区二区| 蜜桃av噜噜一区| www.日韩av| 精品国产伦一区二区三区观看体验 | 亚洲成人av一区| k8久久久一区二区三区| 日韩一级视频免费观看在线| 亚洲猫色日本管| 成人一级黄色片| 欧美挠脚心视频网站| 国产精品久久久久久久第一福利| 久久99久久精品欧美| 在线不卡免费欧美| 亚洲国产精品一区二区www在线| 成人av电影免费观看| 久久久精品tv| 国产剧情av麻豆香蕉精品| 欧美电视剧免费全集观看| 亚洲福利一二三区| 欧美怡红院视频| 亚洲福利视频一区二区| 欧美日韩亚洲综合在线 | 蜜桃视频在线观看一区二区| 91精品福利在线一区二区三区| 亚洲欧洲美洲综合色网| 成人午夜免费电影| 国产精品久久久久久亚洲毛片 | 亚洲一卡二卡三卡四卡| 色偷偷久久一区二区三区| 日韩—二三区免费观看av| 欧美精品久久99久久在免费线 | 成人免费视频网站在线观看| 亚洲欧美色图小说| 色婷婷精品大在线视频| 日韩成人免费看| 久久综合久久鬼色中文字| 久久99国产乱子伦精品免费| 国产精品久久久久久户外露出 | 激情五月播播久久久精品| 日韩欧美成人午夜| 1000精品久久久久久久久| 风流少妇一区二区| 国产丝袜在线精品| 91免费在线看| 亚洲女人****多毛耸耸8| 777亚洲妇女| 国产成人综合亚洲网站| 亚洲三级在线看| 欧美精品一二三四| 狠狠色综合播放一区二区| 国产精品久久久久久久久图文区 | 99精品久久只有精品| 亚洲一区二区欧美激情| 欧美成人欧美edvon| 从欧美一区二区三区| 亚洲综合精品自拍| 欧美精品一区二区蜜臀亚洲| 91香蕉视频在线| 毛片av一区二区| 亚洲欧美电影院| 精品国产一区二区三区不卡| 成人手机在线视频| 日韩精品亚洲一区| 国产精品家庭影院| 欧美一级二级三级乱码| 成人午夜短视频| 蜜臀精品久久久久久蜜臀| 欧美极品xxx| 这里只有精品视频在线观看| 欧美一级黄色录像| 91美女片黄在线观看91美女| 国产视频一区二区在线观看| av在线这里只有精品| 日韩国产欧美在线视频| 中文字幕第一区综合| 91精品欧美久久久久久动漫| 成人久久久精品乱码一区二区三区| 亚洲黄色尤物视频| 国产日韩欧美高清在线| 在线播放日韩导航| 9色porny自拍视频一区二区| 另类综合日韩欧美亚洲| 亚洲影视在线播放| 中文字幕一区二区三区视频 | 综合自拍亚洲综合图不卡区| 日韩欧美国产三级电影视频| 欧美亚洲国产一区二区三区va| 成人一级片网址| 国产精品影视网| 另类综合日韩欧美亚洲| 日日骚欧美日韩| 午夜精品视频一区| 三级在线观看一区二区| 亚洲成人激情av| 国产亚洲污的网站| 久久久美女毛片| 欧美午夜精品免费| 91啪九色porn原创视频在线观看| 欧美aaaaa成人免费观看视频| 一区二区三区在线免费观看| 一区二区理论电影在线观看| 1024成人网| 国产欧美日产一区| 亚洲男人的天堂网| 日韩理论片在线| 午夜av电影一区| 亚洲成人福利片| 国产一区二区精品久久99| 日韩国产精品久久久| 亚洲欧洲综合另类| 一区二区视频在线| 亚洲一区二区高清| 国内精品伊人久久久久av影院 | 国产精品毛片a∨一区二区三区| 日韩一级片在线观看| 91麻豆精品国产| 欧美mv和日韩mv国产网站| 久久久久久免费网| 国产精品三级av| 成人免费小视频| 亚洲福利一二三区| 亚洲国产毛片aaaaa无费看| 亚洲国产精品天堂| 五月婷婷欧美视频| 国产一本一道久久香蕉| 久久久99精品免费观看| 亚洲国产精品综合小说图片区| 亚洲国产精品黑人久久久| 国产精品国产三级国产普通话蜜臀 | 青青草国产精品亚洲专区无| 韩国在线一区二区| 一本到不卡免费一区二区| caoporn国产精品| 在线精品视频免费播放|