WTL_代码使用
流程
普通函数 流程
1. 添加 "头文件"
2. 继承 "类“
3. 使用相应代码
control 流程
1. 引入"atlddx.h"2. 继承CWinDataExchange<self_class>3. 声明BEGIN_DDX_BEGIN(self_class)4. 自定义control_class类, 继承对应control_class5. 声明自定义类对象control_object6. 使用DDX_CONTROL(CONTROL_ID, control_object)7. Initial中 启动DoDataExachange(DDX_LOAD)初始化连接
notify 流程
1. 父窗口需要继承自 CWindowImpl
2. 父窗口使用BEGIN_MSG_MAP_EX
3. 父窗口添加 REFLECT_NOTIFICATIONS()
4. 子窗口接收MSG_OCM_DRAWITEM(OnReflectedDrawItem)
5. 子窗口添加DEFAULT_REFLECTION_HANDLER() 默认处理
custom draw 流程
1. REFLECT_NOTIFICATIONS()
1. 继承CCustomDraw<CBuffyTreeCtrl>
2. (1)REFLECTED_NOTIFY_CODE_HANDLER_EX(TVN_ITEMEXPANDING, OnItemExpanding)
(2)MSG_OCM_DRAWITEM(OnDrawItem)<- 由MSG_MSG_DRAWITEM转化来
ActiveX control 流程
1. "atlcom.h" "atlhost.h"
2. 继承public CAxDialogImpl<CMainDlg>
3. 初始化AtlAxWinInit();
4. 最好传给_Module.Init(NULL, hInstance, &LIBID_ATLLib);
使用
列表
reflect 消息 : 18个
这里列举了18个可以反映的消息:
o Control notifications: WM_COMMAND, WM_NOTIFY, WM_PARENTNOTIFY
o Owner drawing: WM_DRAWITEM, WM_MEASUREITEM, WM_COMPAREITEM, WM_DELETEITEM
o List Box keyboard messages : WM_VKEYTOITEM, WM_CHARTOITEM
o Others: WM_HSCROLL, WM_VSCROLL, WM_CTLCOLOR*
WTL控件 : X
o 用户控件: CStatic, CButton, CListBox, CComboBox,CEdit, CScrollBar, CDragListBox
o 普通控件: CImageList, CListViewCtrl (CListCtrl in MFC),CTreeViewCtrl (CTreeCtrl in MFC), CHeaderCtrl,CToolBarCtrl,CStatusBarCtrl, CTabCtrl, CToolTipCtrl, CTrackBarCtrl (CSliderCtrl in MFC),CUpDownCtrl(CSpinButtonCtrl in MFC), CProgressBarCtrl, CHotKeyCtrl,CAnimateCtrl, CRichEditCtrl, CReBarCtrl, CComboBoxEx,CDateTimePickerCtrl,CMonthCalendarCtrl, CIPAddressCtrlo 普通控件(MFC中没有的): CPagerCtrl, CFlatScrollBar, CLinkCtrl
o 这里还有一些 WTL-Specific 类:CBitmapButton,CCheckListViewCtrl (list view control with check boxes),CTreeViewCtrlEx andCTreeItem (used together, CTreeItem wraps an HTREEITEM),CHyperLink (clickable hyperlink, available on all OSes)
Custom Draw控件 : 7个
Header controls
List-view controls
Rebar controls
Toolbar controls
Tooltip controls
Trackbar controls
Tree-view controls