标签:des style class blog code tar
atlctrls.h中是对控件的封装。
第1249行增加:
void GetMargins(UINT& nLeft, UINT& nRight) const { ATLASSERT(::IsWindow(m_hWnd)); DWORD dwRet = (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); nLeft = LOWORD(dwRet); nRight = HIWORD(dwRet); }
没什么好说的,原来的函数是以返回值的方式获取:
DWORD GetMargins() const { ATLASSERT(::IsWindow(m_hWnd)); return (DWORD)::SendMessage(m_hWnd, EM_GETMARGINS, 0, 0L); }
第1858行,CImageList变成了模板类,增加了自动销毁模板开头:
// forward declarations
template <bool t_bManaged> class CImageListT;
typedef CImageListT<false> CImageList;
typedef CImageListT<true> CImageListManaged;
template <bool t_bManaged>
class CImageListT
{
public:
// Data members
HIMAGELIST m_hImageList;
// Constructor/destructor/operators
CImageListT(HIMAGELIST hImageList = NULL) : m_hImageList(hImageList)
{ }
~CImageListT()
{
if(t_bManaged && (m_hImageList != NULL))
Destroy();
}
第3706行,CListViewCtrlT.FindItem 增加了一个重载:
int FindItem(LPCTSTR lpstrFind, bool bPartial = true, bool bWrap = false, int nStart = -1) const { ATLASSERT(::IsWindow(m_hWnd)); LVFINDINFO lvfi = { 0 }; lvfi.flags = LVFI_STRING | (bWrap ? LVFI_WRAP : 0) | (bPartial ? LVFI_PARTIAL : 0); lvfi.psz = lpstrFind; return (int)::SendMessage(m_hWnd, LVM_FINDITEM, nStart, (LPARAM)&lvfi); }
查找ListView item时不用费劲地填结构体了。
第5819行,CToolBarCtrlT增加GetItemDropDownRect:
void GetItemDropDownRect(int nIndex, LPRECT lpRect) const { #ifndef TB_GETITEMDROPDOWNRECT const int TB_GETITEMDROPDOWNRECT = WM_USER + 103; #endif ATLASSERT(::IsWindow(m_hWnd)); BOOL bRet = (BOOL)::SendMessage(m_hWnd, TB_GETITEMDROPDOWNRECT, nIndex, (LPARAM)lpRect); bRet; // avoid level 4 warning ATLASSERT(bRet != FALSE); }
用来获取工具栏上下拉框的窗口矩形大小。(_WIN32_WINNT >= 0x0600)
第5934行,CToolBarCtrlT增加:
BOOL InsertSeparator(int nIndex, int cxWidth = 8) { return InsertButton(nIndex, 0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); } BOOL AddSeparator(int cxWidth = 8) { return AddButton(0, BTNS_SEP, 0, cxWidth, (INT_PTR)0, 0); }
用来添加工具栏上的分隔线。
第6397行,GetToolTips、SetToolTips中的tips由小写变成了大写Tips……。
第6656行,CTrackBarCtrlT.SetSelStart 和接下来的SetSelEnd、SetSelection增加了bRedraw参数:
void SetSelStart(int nMin, BOOL bRedraw = FALSE) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, TBM_SETSELSTART, bRedraw, (LPARAM)nMin); }
第7291行,增加了RichEdit 5的宏定义:
#if !defined(_UNICODE) && (_RICHEDIT_VER >= 0x0500) #undef MSFTEDIT_CLASS #define MSFTEDIT_CLASS "RICHEDIT50W" #endif
这影响到CRichEditCtrlT调用的是哪个版本的RichEdit控件。
static LPCTSTR GetLibraryName() { #if (_RICHEDIT_VER >= 0x0500) return _T("MSFTEDIT.DLL"); #elif (_RICHEDIT_VER >= 0x0200) return _T("RICHED20.DLL"); #else return _T("RICHED32.DLL"); #endif }
第7825行,增加CRichEditCtrlT.GetWordBreakProc 和CRichEditCtrlT.SetWordBreakProc :
EDITWORDBREAKPROC GetWordBreakProc() const { ATLASSERT(::IsWindow(m_hWnd)); return (EDITWORDBREAKPROC)::SendMessage(m_hWnd, EM_GETWORDBREAKPROC, 0, 0L); } void SetWordBreakProc(EDITWORDBREAKPROC ewbprc) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, EM_SETWORDBREAKPROC, 0, (LPARAM)ewbprc); }
第8160行,为RichEdit 8增加的代码:
#if (_RICHEDIT_VER >= 0x0800) AutoCorrectProc GetAutoCorrectProc() const { ATLASSERT(::IsWindow(m_hWnd)); return (AutoCorrectProc)::SendMessage(m_hWnd, EM_GETAUTOCORRECTPROC, 0, 0L); } BOOL SetAutoCorrectProc(AutoCorrectProc pfn) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_SETAUTOCORRECTPROC, (WPARAM)pfn, 0L); } BOOL CallAutoCorrectProc(WCHAR ch) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_CALLAUTOCORRECTPROC, (WPARAM)ch, 0L); } DWORD GetEditStyleEx() const { ATLASSERT(::IsWindow(m_hWnd)); return (DWORD)::SendMessage(m_hWnd, EM_GETEDITSTYLEEX, 0, 0L); } DWORD SetEditStyleEx(DWORD dwStyleEx, DWORD dwMask) { ATLASSERT(::IsWindow(m_hWnd)); return (DWORD)::SendMessage(m_hWnd, EM_SETEDITSTYLEEX, dwStyleEx, dwMask); } DWORD GetStoryType(int nStoryIndex) const { ATLASSERT(::IsWindow(m_hWnd)); return (DWORD)::SendMessage(m_hWnd, EM_GETSTORYTYPE, nStoryIndex, 0L); } DWORD SetStoryType(int nStoryIndex, DWORD dwStoryType) { ATLASSERT(::IsWindow(m_hWnd)); return (DWORD)::SendMessage(m_hWnd, EM_SETSTORYTYPE, nStoryIndex, dwStoryType); } DWORD GetEllipsisMode() const { ATLASSERT(::IsWindow(m_hWnd)); DWORD dwMode = 0; BOOL bRet = (BOOL)::SendMessage(m_hWnd, EM_GETELLIPSISMODE, 0, (LPARAM)&dwMode); bRet; // avoid level 4 warning ATLASSERT(bRet != FALSE); return dwMode; } BOOL SetEllipsisMode(DWORD dwEllipsisMode) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_SETELLIPSISMODE, 0, dwEllipsisMode); } BOOL GetEllipsisState() const { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_GETELLIPSISSTATE, 0, 0L); } BOOL GetTouchOptions(int nTouchOptions) const { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_GETTOUCHOPTIONS, nTouchOptions, 0L); } void SetTouchOptions(int nTouchOptions, BOOL bEnable) { ATLASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, EM_SETTOUCHOPTIONS, nTouchOptions, bEnable); } HRESULT InsertTable(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) { ATLASSERT(::IsWindow(m_hWnd)); return (HRESULT)::SendMessage(m_hWnd, EM_INSERTTABLE, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT GetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) const { ATLASSERT(::IsWindow(m_hWnd)); return (HRESULT)::SendMessage(m_hWnd, EM_GETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT SetTableParams(TABLEROWPARMS* pRowParams, TABLECELLPARMS* pCellParams) { ATLASSERT(::IsWindow(m_hWnd)); return (HRESULT)::SendMessage(m_hWnd, EM_SETTABLEPARMS, (WPARAM)pRowParams, (LPARAM)pCellParams); } HRESULT InsertImage(RICHEDIT_IMAGE_PARAMETERS* pParams) { ATLASSERT(::IsWindow(m_hWnd)); return (HRESULT)::SendMessage(m_hWnd, EM_INSERTIMAGE, 0, (LPARAM)pParams); } BOOL SetUiaName(LPCTSTR lpstrName) { ATLASSERT(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, EM_SETUIANAME, 0, (LPARAM)lpstrName); } #endif // (_RICHEDIT_VER >= 0x0800)
总体来说,atlctrls.h中最大的更改就属CRichEditCtrlT了。
WTL 9.0的变化 - atlctrls.h,布布扣,bubuko.com
标签:des style class blog code tar
原文地址:http://www.cnblogs.com/honker/p/3785930.html