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

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

?? wtl for mfc programmers, part iv.mht

?? 大家知道wtl是window UI庫
?? MHT
?? 第 1 頁 / 共 5 頁
字號:
      you can use the MFC documentation whilst using the WTL wrappers. =
Failing=20
      that, the F12 key comes in handy when you need to jump to the =
definition=20
      of one of the classes.</P>
      <P>Here are the wrapper classes for built-in controls:</P>
      <UL>
        <LI>User controls: <CODE>CStatic</CODE>, <CODE>CButton</CODE>,=20
        <CODE>CListBox</CODE>, <CODE>CComboBox</CODE>, =
<CODE>CEdit</CODE>,=20
        <CODE>CScrollBar</CODE>, <CODE>CDragListBox</CODE>=20
        <LI>Common controls: <CODE>CImageList</CODE>, =
<CODE>CListViewCtrl</CODE>=20
        (<CODE>CListCtrl</CODE> in MFC), <CODE>CTreeViewCtrl</CODE>=20
        (<CODE>CTreeCtrl</CODE> in MFC), <CODE>CHeaderCtrl</CODE>,=20
        <CODE>CToolBarCtrl</CODE>, <CODE>CStatusBarCtrl</CODE>,=20
        <CODE>CTabCtrl</CODE>, <CODE>CToolTipCtrl</CODE>,=20
        <CODE>CTrackBarCtrl</CODE> (<CODE>CSliderCtrl</CODE> in MFC),=20
        <CODE>CUpDownCtrl</CODE> (<CODE>CSpinButtonCtrl</CODE> in MFC),=20
        <CODE>CProgressBarCtrl</CODE>, <CODE>CHotKeyCtrl</CODE>,=20
        <CODE>CAnimateCtrl</CODE>, <CODE>CRichEditCtrl</CODE>,=20
        <CODE>CReBarCtrl</CODE>, <CODE>CComboBoxEx</CODE>,=20
        <CODE>CDateTimePickerCtrl</CODE>, =
<CODE>CMonthCalendarCtrl</CODE>,=20
        <CODE>CIPAddressCtrl</CODE>=20
        <LI>Common control wrappers not in MFC: <CODE>CPagerCtrl</CODE>, =

        <CODE>CFlatScrollBar</CODE>, <CODE>CLinkCtrl</CODE> (clickable=20
        hyperlink, available on XP only) </LI></UL>
      <P>There are also a few WTL-specific classes: =
<CODE>CBitmapButton</CODE>,=20
      <CODE>CCheckListViewCtrl</CODE> (list view control with check =
boxes),=20
      <CODE>CTreeViewCtrlEx</CODE> and <CODE>CTreeItem</CODE> (used =
together,=20
      <CODE>CTreeItem</CODE> wraps an <CODE>HTREEITEM</CODE>),=20
      <CODE>CHyperLink</CODE> (clickable hyperlink, available on all =
OSes)</P>
      <P>One thing to note is that most of the wrapper classes are =
window=20
      interface classes, like <CODE>CWindow</CODE>. They wrap an=20
      <CODE>HWND</CODE> and provide wrappers around messages (for =
instance,=20
      <CODE>CListBox::GetCurSel()</CODE> wraps =
<CODE>LB_GETCURSEL</CODE>). So=20
      like <CODE>CWindow</CODE>, it is cheap to create a temporary =
control=20
      wrapper and attach it to an existing control. Also like=20
      <CODE>CWindow</CODE>, the control is not destroyed when the =
control=20
      wrapper is destructed. The exceptions are =
<CODE>CBitmapButton</CODE>,=20
      <CODE>CCheckListViewCtrl</CODE>, and <CODE>CHyperLink</CODE>.</P>
      <P>Since these articles are aimed at experienced MFC programmers, =
I won't=20
      be spending much time on the details of the wrapper classes that =
are=20
      similar to their MFC counterparts. I will, however, be covering =
the new=20
      classes in WTL; <CODE>CBitmapButton</CODE> is quite different from =
the MFC=20
      class of the same name, and <CODE>CHyperLink</CODE> is completely =
new.</P>
      <H2><A name=3Dappwizard></A>Creating a Dialog-Based App with the=20
      AppWizard</H2>
      <P>Fire up VC and start the WTL AppWizard. I'm sure you're as =
tired as I=20
      am with clock apps, so let's call our next app =
<I>ControlMania1</I>. On=20
      the first page of the AppWizard, click <I>Dialog Based</I>. We =
also have a=20
      choice between making a modal or modeless dialog. The difference =
is=20
      important and I will cover it in Part V, but for now let's go with =
the=20
      simpler one, modal. Check <I>Modal Dialog</I> and <I>Generate .CPP =

      Files</I> as shown here:</P>
      <P><IMG height=3D387 alt=3D" [AppWizard page 1 - 21K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/appwiz1.png" =
width=3D477=20
      align=3Dbottom border=3D0></P>
      <P>All the options on the second page are only meaningful when the =
main=20
      window is a frame window, so they are all disabled. Click =
<I>Finish</I>=20
      and then <I>OK</I> to complete the wizard.</P>
      <P>As you might expect, the AppWizard-generated code is much =
simpler for a=20
      dialog-based app. ControlMania1.cpp has the =
<CODE>_tWinMain()</CODE>=20
      function, here are the important parts:</P><PRE><SPAN =
class=3Dcpp-keyword>int</SPAN> WINAPI _tWinMain (=20
    HINSTANCE hInstance, HINSTANCE <SPAN =
class=3Dcpp-comment>/*hPrevInstance*/</SPAN>,=20
    LPTSTR lpstrCmdLine, <SPAN class=3Dcpp-keyword>int</SPAN> nCmdShow )
{
    HRESULT hRes =3D ::CoInitialize(NULL);
=20
    AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);
=20
    hRes =3D _Module.Init(NULL, hInstance);
=20
    <SPAN class=3Dcpp-keyword>int</SPAN> nRet =3D <SPAN =
class=3Dcpp-literal>0</SPAN>;
    <SPAN class=3Dcpp-comment>// BLOCK: Run application</SPAN>
    {
        CMainDlg dlgMain;
        nRet =3D dlgMain.DoModal();
    }
=20
    _Module.Term();
    ::CoUninitialize();
    <SPAN class=3Dcpp-keyword>return</SPAN> nRet;
}</PRE>
      <P>The code first initializes COM and creates a single-threaded =
apartment.=20
      This is necessary for dialogs that host ActiveX controls. Next, =
the code=20
      calls the WTL utility function =
<CODE>AtlInitCommonControls()</CODE>, which=20
      is a wrapper for <CODE>InitCommonControlsEx()</CODE>. The global=20
      <CODE>_Module</CODE> is initialized, and the main dialog is =
displayed.=20
      (Note that ATL dialogs created with <CODE>DoModal()</CODE> =
actually are=20
      modal, unlike MFC where all dialogs are modeless and MFC simulates =

      modality by manually disabling the dialog's parent.) Finally,=20
      <CODE>_Module</CODE> and COM are uninitialized, and the value =
returned by=20
      <CODE>DoModal()</CODE> is used as the app's exit code.</P>
      <BLOCKQUOTE>
        <P>The block around the <CODE>CMainDlg</CODE> variable is =
important=20
        because <CODE>CMainDlg</CODE> may have members that use ATL and =
WTL=20
        features. Those members may also use ATL/WTL features in their=20
        destructors. If the block were not present, the =
<CODE>CMainDlg</CODE>=20
        destructor (and the destructors of the members) would run after =
the call=20
        to <CODE>_Module.Term()</CODE> (which uninitializes ATL/WTL) and =
try to=20
        use ATL/WTL features, which could cause a hard-to-diagnose =
crash. (As a=20
        historical note, the WTL 3 AppWizard-generated code did not have =
a block=20
        there, and some of my apps did crash.)</P></BLOCKQUOTE>
      <P>You can build and run the app right away, although the dialog =
is pretty=20
      bare:</P>
      <P><IMG height=3D187 alt=3D" [Bare dialog - 4K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/bareapp.png" =
width=3D287=20
      align=3Dbottom border=3D0></P>
      <P>The code in <CODE>CMainDlg</CODE> handles =
<CODE>WM_INITDIALOG</CODE>,=20
      <CODE>WM_CLOSE</CODE>, and all three buttons. Take a quick glance =
through=20
      the code now if you like; you should be able to follow the=20
      <CODE>CMainDlg</CODE> declaration, its message map, and its =
message=20
      handlers.</P>
      <P>This sample project will demonstrate how to hook up variables =
to the=20
      controls. Here's the app with a couple more controls; you can =
refer back=20
      to this diagram for the following discussions.</P>
      <P><IMG height=3D227 alt=3D" [Add'l controls - 6K] "=20
      src=3D"http://www.codeproject.com/wtl/WTL4MFC4/cm1ctrls.png" =
width=3D507=20
      align=3Dbottom border=3D0></P>
      <P>Since the app uses a list view control, the call to=20
      <CODE>AtlInitCommonControls()</CODE> will need to be changed. =
Change it=20
      to:</P><PRE>    AtlInitCommonControls ( ICC_WIN95_CLASSES );</PRE>
      <P>That registers more classes than necessary, but it saves us =
having to=20
      remember to add <CODE>ICC_*</CODE> constants when we add different =
types=20
      of controls to the dialog.</P>
      <H2><A name=3Dusingwrap></A>Using the Control Wrapper Classes</H2>
      <P>There are several ways to associate a member variable with a =
control.=20
      Some use plain <CODE>CWindow</CODE>s (or another window interface =
class,=20
      like <CODE>CListViewCtrl</CODE>), while others use a=20
      <CODE>CWindowImpl</CODE>-derived class. Using a =
<CODE>CWindow</CODE> is=20
      fine if you just need a temporary variable, while a=20
      <CODE>CWindowImpl</CODE> is required if you need to subclass a =
control and=20
      handle messages sent to it.</P>
      <H3><A name=3Datl1></A>ATL Way 1 - Attaching a CWindow</H3>
      <P>The simplest method is to declare a <CODE>CWindow</CODE> or =
other=20
      window interface class, and call its <CODE>Attach()</CODE> method. =
You can=20
      also use the <CODE>CWindow</CODE> constructor or assignment =
operator to=20
      associate the variable with a control's <CODE>HWND</CODE>.</P>
      <P>This code demonstrates all three methods of associating =
variables with=20
      the list control:</P><PRE>HWND hwndList =3D GetDlgItem(IDC_LIST);
CListViewCtrl wndList1 (hwndList);  <SPAN class=3Dcpp-comment>// use =
constructor</SPAN>
CListViewCtrl wndList2, wndList3;
=20
  wndList2.Attach ( hwndList );     <SPAN class=3Dcpp-comment>// use =
Attach method</SPAN>
  wndList3 =3D hwndList;              <SPAN class=3Dcpp-comment>// use =
assignment operator</SPAN></PRE>
      <P>Remember that the <CODE>CWindow</CODE> destructor does not =
destroy the=20
      window, so there is no need to detach the variables before they go =
out of=20
      scope. You can also use this technique with member variables if =
you wish -=20
      you can attach the variables in the <CODE>OnInitDialog()</CODE>=20
      handler.</P>
      <H3><A name=3Datl2></A>ATL Way 2 - CContainedWindow</H3>
      <P><CODE>CContainedWindow</CODE> is sort of halfway between using =
a=20
      <CODE>CWindow</CODE> and a <CODE>CWindowImpl</CODE>. It lets you =
subclass=20
      a control, then handle that control's messages <I>in the control's =
parent=20
      window</I>. This lets you put all the message handlers in the =
dialog=20
      class, and you don't have to write separate =
<CODE>CWindowImpl</CODE>=20
      classes for each control. Note that you don't use=20
      <CODE>CContainedWindow</CODE> to handle <CODE>WM_COMMAND</CODE>,=20
      <CODE>WM_NOTIFY</CODE>, or other notification messages, because =
those are=20
      always sent to the control's parent.</P>
      <P>The actual class, <CODE>CContainedWindowT</CODE>, is a template =
class=20
      that takes a window interface class name as its template =
parameter. There=20
      is a specialization <CODE>CContainedWindowT&lt;CWindow&gt;</CODE> =
that=20
      works like a plain <CODE>CWindow</CODE>; this is typedef'ed to the =
shorter=20
      name <CODE>CContainedWindow</CODE>. To use a different window =
interface=20
      class, specify its name as the template parameter, for example=20
      <CODE>CContainedWindowT&lt;CListViewCtrl&gt;</CODE>.</P>
      <P>To hook up a <CODE>CContainedWindow</CODE>, you do four =
things:</P>
      <OL>
        <LI>Create a <CODE>CContainedWindowT</CODE> member variable in =
the=20
        dialog.=20
        <LI>Put handlers in an <CODE>ALT_MSG_MAP</CODE> section of the =
dialog's=20
        message map=20
        <LI>In the dialog's constructor, call the =
<CODE>CContainedWindowT</CODE>=20
        constructor and tell it which <CODE>ALT_MSG_MAP</CODE> section =
it should=20
        route messages to.=20
        <LI>In <CODE>OnInitDialog()</CODE>, call the=20
        <CODE>CContainedWindowT::SubclassWindow()</CODE> method to =
associate a=20
        variable with a control. </LI></OL>
      <P>In ControlMania1, we'll use a <CODE>CContainedWindow</CODE> for =
each of=20
      the three buttons. The dialog will handle =
<CODE>WM_SETCURSOR</CODE>=20
      messages sent to each button, and change the cursor.</P>
      <P>Let's go through the steps. First, we add =
<CODE>CContainedWindow</CODE>=20
      members in <CODE>CMainDlg.</CODE></P><PRE><SPAN =
class=3Dcpp-keyword>class</SPAN> CMainDlg : <SPAN =
class=3Dcpp-keyword>public</SPAN> CDialogImpl&lt;CMainDlg&gt;
{
<SPAN class=3Dcpp-comment>// ...</SPAN>
<SPAN class=3Dcpp-keyword>protected</SPAN>:
    CContainedWindow m_wndOKBtn, m_wndExitBtn;
};</PRE>
      <P>Second, we add <CODE>ALT_MSG_MAP</CODE> sections. The <I>OK</I> =
button=20
      will use section 1, while the <I>Exit</I> button will use section =
2. This=20
      means that all messages sent to the <I>OK</I> button will be =
routed to the=20
      <CODE>ALT_MSG_MAP(<SPAN class=3Dcpp-literal>1</SPAN>)</CODE> =
section, and=20
      all messages sent to the <I>Exit</I> button will be routed to the=20
      <CODE>ALT_MSG_MAP(<SPAN class=3Dcpp-literal>2</SPAN>)</CODE> =
section.</P><PRE><SPAN class=3Dcpp-keyword>class</SPAN> CMainDlg : <SPAN =
class=3Dcpp-keyword>public</SPAN> CDialogImpl&lt;CMainDlg&gt;
{
<SPAN class=3Dcpp-keyword>public</SPAN>:
    BEGIN_MSG_MAP_EX(CMainDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        COMMAND_ID_HANDLER(ID_APP_ABOUT, OnAppAbout)
        COMMAND_ID_HANDLER(IDOK, OnOK)
        COMMAND_ID_HANDLER(IDCANCEL, OnCancel)
    <B>ALT_MSG_MAP(<SPAN class=3Dcpp-literal>1</SPAN>)
        MSG_WM_SETCURSOR(OnSetCursor_OK)
    ALT_MSG_MAP(<SPAN class=3Dcpp-literal>2</SPAN>)
        MSG_WM_SETCURSOR(OnSetCursor_Exit)</B>
    END_MSG_MAP()
=20
    <B>LRESULT OnSetCursor_OK(HWND hwndCtrl, UINT uHitTest, UINT =
uMouseMsg);
    LRESULT OnSetCursor_Exit(HWND hwndCtrl, UINT uHitTest, UINT =
uMouseMsg);</B>
};</PRE>
      <P>Third, we call the <CODE>CContainedWindow</CODE> constructor =
for each=20
      member and tell it which <CODE>ALT_MSG_MAP</CODE> section to =

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品国产久精国产爱| 日韩成人精品视频| 91 com成人网| 成人av在线一区二区三区| 亚洲成人黄色影院| 国产精品国模大尺度视频| 欧美成人激情免费网| 91麻豆免费视频| 国产黄色精品网站| 石原莉奈在线亚洲三区| 中文字幕一区av| 久久久久久综合| 欧美美女喷水视频| 色综合久久综合网97色综合| 韩日av一区二区| 婷婷久久综合九色国产成人| 国产精品电影一区二区| 精品国产乱码久久| 欧美理论在线播放| 色综合久久综合中文综合网| 国产麻豆成人精品| 免播放器亚洲一区| 日韩精品一二三| 亚洲永久免费视频| 亚洲另类色综合网站| 国产精品日日摸夜夜摸av| 日韩亚洲欧美综合| 91精品国产一区二区三区蜜臀| 欧美天堂一区二区三区| 91丨九色丨黑人外教| 国产 日韩 欧美大片| 国产乱理伦片在线观看夜一区| 免费看日韩精品| 青娱乐精品视频| 午夜精品成人在线视频| 视频在线在亚洲| 亚洲午夜精品网| 亚洲国产成人av| 视频一区视频二区中文字幕| 亚洲电影你懂得| 亚洲成人av免费| 亚洲电影第三页| 夜夜嗨av一区二区三区网页| 欧美影视一区在线| 在线观看国产91| 在线观看av不卡| 欧美在线免费观看视频| 欧美性受极品xxxx喷水| 日韩欧美电影在线| 精品福利在线导航| 精品成人佐山爱一区二区| 精品sm在线观看| 国产目拍亚洲精品99久久精品| 国产日韩精品视频一区| 亚洲国产精品黑人久久久| 亚洲色图一区二区| 亚洲一区二区三区四区在线免费观看 | 日韩一区二区三区电影| 精品日韩99亚洲| 国产精品系列在线| 亚洲欧美另类久久久精品2019| 亚洲素人一区二区| 午夜精品一区在线观看| 久久超碰97中文字幕| 国产成人免费高清| 91在线视频观看| 欧美日韩激情一区二区三区| 日韩精品一区二区三区在线播放 | 欧美曰成人黄网| 337p亚洲精品色噜噜噜| 精品粉嫩超白一线天av| 国产精品久久福利| 日韩av电影一区| 成人av电影在线网| 91麻豆精品国产91久久久使用方法 | 岛国精品一区二区| 在线免费不卡电影| wwww国产精品欧美| 亚洲精品高清视频在线观看| 全国精品久久少妇| 成人黄色国产精品网站大全在线免费观看 | 99久久精品99国产精品| 国产一区二区剧情av在线| 99热这里都是精品| 在线观看av一区二区| 91精品国产aⅴ一区二区| 久久综合色天天久久综合图片| 国产农村妇女精品| 一区二区欧美在线观看| 亚洲大片免费看| 成人亚洲一区二区一| 欧洲精品中文字幕| 久久综合视频网| 亚洲精选视频免费看| 日韩av电影免费观看高清完整版在线观看| 另类人妖一区二区av| 国产成人精品www牛牛影视| 欧美日韩国产大片| 欧美经典一区二区三区| 亚洲图片一区二区| 国产精品2024| 在线成人高清不卡| 国产精品嫩草久久久久| 秋霞午夜av一区二区三区| bt欧美亚洲午夜电影天堂| 欧美一区二区三区在线观看视频| 欧美韩国日本不卡| 麻豆国产精品官网| av在线播放一区二区三区| 91精品国产综合久久香蕉的特点| 国产欧美视频一区二区三区| 亚洲精品国产无套在线观| 成人一级视频在线观看| 日韩精品一区二区三区视频 | 日韩亚洲欧美高清| 亚洲人成亚洲人成在线观看图片 | 不卡av在线免费观看| 7777精品伊人久久久大香线蕉完整版| 久久九九99视频| 午夜成人免费电影| 成人福利视频在线| 欧美成人三级在线| 亚洲va国产天堂va久久en| 91色在线porny| 久久精品网站免费观看| 久久精品国产99国产| 91精品国产91久久综合桃花| 一区二区三区在线免费播放| 成人黄色大片在线观看| 国产三级三级三级精品8ⅰ区| 日产国产欧美视频一区精品| 在线观看亚洲a| 国产午夜亚洲精品理论片色戒| 国产综合一区二区| 精品国内二区三区| 蜜臀99久久精品久久久久久软件| 精品视频一区二区不卡| 亚洲精品国产一区二区精华液| 成人免费毛片嘿嘿连载视频| 欧美成人一区二区三区片免费| 极品少妇xxxx精品少妇| 91精品国产色综合久久不卡蜜臀 | 成人一区在线看| 欧美不卡一区二区三区四区| 日韩在线a电影| 成人毛片视频在线观看| 国产精品美女久久久久aⅴ| 国产成人午夜99999| 精品国产免费人成在线观看| 男女视频一区二区| 日韩欧美色综合网站| 亚洲视频一区二区在线| 欧美中文字幕一区二区三区亚洲| 亚洲免费av网站| 欧洲亚洲国产日韩| 亚洲成人精品一区二区| 欧美福利一区二区| 亚洲一区二区黄色| 欧美一区二区在线不卡| 久久国产尿小便嘘嘘尿| 欧美变态tickling挠脚心| 激情久久五月天| 国产欧美一区二区三区网站| 国产盗摄一区二区三区| 国产三级精品三级在线专区| 国产98色在线|日韩| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美一区二区三区思思人| 蜜臀av一区二区在线免费观看| 日韩精品一区二区三区中文不卡| 日本成人在线电影网| 国产精品你懂的在线欣赏| 91亚洲精品久久久蜜桃| 亚洲综合免费观看高清完整版 | 国产欧美精品一区二区色综合| 成人的网站免费观看| 1024精品合集| 欧美剧情片在线观看| 国产美女精品人人做人人爽| 最新不卡av在线| 欧美日韩亚洲综合在线| 偷拍日韩校园综合在线| 国产精品全国免费观看高清| 在线视频亚洲一区| 精品一区二区免费看| 亚洲国产精品v| 欧美日精品一区视频| 亚洲一卡二卡三卡四卡五卡| 久久久不卡影院| 在线免费亚洲电影| 激情丁香综合五月| 亚洲精品少妇30p| 日韩欧美国产麻豆| 国产不卡在线播放| 免费国产亚洲视频| 亚洲三级视频在线观看| 91精品国产91热久久久做人人| 成人晚上爱看视频| 秋霞午夜鲁丝一区二区老狼| 欧美激情在线一区二区三区|