Windows模板库 - WTL 版本7.5

Windows Template Library - WTL Version 7.5         (build 4291) 10/17/04
Development Release

Copyright © 2004 Microsoft Corporation. All rights reserved.
 
本文是Windows模板库(Windows Template Library)的一部分。这个软件的使用与分发条款遵循Common Public License 1.0 (http://opensource.org/licenses/cpl.php)  也可以在本发布的根目录下的CPL.TXT文件中找到。 以任何方式使用这个软件都表示你已经同意这个许可条款的限制。你不能从这个软件中删除这个注意事项或者其他任何东西。

 

 

欢迎使用Windows模板库,版本7.5。这个文档包含以下内容:

  1. 简介
  2. 特征与安装
  3. 文件列表
  4. 类纵览
  5. ATL/WTL AppWizard
  6. Windows CE支持
  7. 注意事项
  8. WTL 7.1到7.5的改变
  9. WTL 7.0到71的改变
  10. WTL 3.1到7.0的改变
  11. WTL 3.0到3.1的改变

 

 

1. 简介

 

Windows Template Library, 或 WTL, 是一个扩展ATL以支持更复杂的应用程序或者各种不同的UI组件的用户界面的类的集合,并且维持ATL的一个大优势 - 紧凑而快速的代码。 WTL类设计 classes were designed to be the best and the easiest way to implement rich Win32 based UI for ATL based applications, servers, components, and controls.

 

WTL provides support for implementing many user interface elements, from frame and popup windows, to MDI, standard and common controls, common dialogs, property sheets and pages, GDI objects, UI updating, scrollable windows, splitter windows, command bars, etc. The WTL classes are mostly templated and use minimal instance data and inline functions. They were not designed as a framework, so they do not force a particular application model, and can accommodate any. The classes do not use hooks or thread local storage, so they have no restrictions that those techniques impose. They also have no inter-dependencies and can be freely mixed with straight SDK code. In summary, WTL delivers very small and efficient code, very close in size and speed to SDK programs, while presenting a more logical, object oriented model to a programmer.

 

 

2. Features And Installation

 

This is the fifth public release of WTL, after WTL 3.0, 3.1, 7.0, and 7.1. It is also the first release of WTL under the Common Public License, enabling developers from the WTL community to contribute to the library.

 

WTL classes can be used with either VC++ 6.0 and ATL 3.0, VC++ .NET 2002 and ATL 7.0, VC++ .NET 2003 and ATL 7.1, or EVC++ 4.0 or 3.0 with ATL for Windows CE. AppWizard for VC++ .NET 2002 and 2003 is included.

 

The WTL classes are provided in header files located in the include directory. The only header files that must be included is atlapp.h, while others can be used when needed. The name of the file doesn't mean that you have to create an application, just that atlapp.h contains base definitions required for WTL projects.

 

To install WTL, just copy the whole directory structure, or unpack the archive file, to the location of your choice. Please be sure to add the WTL/include directory to the list of include directories in VC++, so that the compiler can find them when you include them in your projects..

 

Setup programs for the AppWizard are provided. After executing the setup scripts, ATL/WTL AppWizard will appear in the list of AppWizards when you select File.New.Project in VC++ IDE. The file AppWiz70/setup70.js is the setup script for VC++ .NET 2002, while AppWiz70/setup71.js is for VC++ .NET 2003.

 

To manually install AppWizard for VC++ .NET 2002, copy all WTLApp70.* files from AppWiz70/Files to VC++ .NET projects directory, %VC7DIR%/Vc7/vcprojects, where %VC7DIR% is the directory where VC++ .NET 2002 is installed. After that, open WTLApp70.vsz and modify the like that contains ABSOLUTE_PATH to contain %WTLDIR%/AppWiz70/Files, where %WTLDIR% is the directory where WTL files are.

 

For VC++ .NET 2003 use the WTLApp71.* files with the same steps.

 

Platform support and requirements:

 

    Compiler/IDE/ATL:

            Visual C++ 6.0   (ATL 3.0)

            Visual C++.NET 2002   (ATL 7.0)

            Visual C++.NET 2003   (ATL 7.1)

 

    SDK (optional):

            Any Platform SDK from January 2000 release up to the latest (February 2003)

 

    Windows CE development:

            eMbedded Visual C++ 3.0 - Pocket PC, Pocket PC 2002

            eMbedded Visual C++ 4.0 - STANDARDSDK_410, Pocket PC 2003, Smartphone 2003

 

This release also brings the preliminary support for the Visual Studio 2005 (codename Whidbey) Beta1. App Wizards for both Windows applications and SmartDevice projects are provided.

 

 

3. Packing List

 

File Name:Description:

readme.htmthis file
CPL.TXTCommon Public License
 
include/
    atlapp.hmessage loop, interfaces, general app stuff
    atlcrack.hmessage cracker macros
    atlctrls.hstandard and common control classes
    atlctrlw.hcommand bar class
    atlctrlx.hbitmap button, check list view, and other controls
    atlddx.hdata exchange for dialogs and windows
    atldlgs.hcommon dialog classes, property sheet and page classes
    atlframe.hframe window classes, MDI, update UI classes
    atlgdi.hDC classes, GDI object classes
    atlmisc.hWTL ports of CPoint, CRect, CSize, CString, etc.
    atlprint.hprinting and print preview
    atlres.hstandard resource IDs
    atlresce.hstandard resource IDs for Windows CE
    atlscrl.hscrollable windows
    atlsplit.hsplitter windows
    atltheme.hWindows XP theme classes
    atluser.hmenu class
    atlwinx.hextensions of ATL windowing support
 
samples/
    Alpha/...Windows XP 32-bit (alpha) toolbar images
    BmpView/...bitmap file view sample
    MTPad/...multithreaded notepad sample
    MDIDocVw/...WTL version of the MDI sample
    GuidGen/...WTL version of the GuidGen sample
    WTLExplorer/...Explorer-like application sample
 
appwiz/
    setup70.jsAppWizard setup program for VC++ .NET 2002
    setup71.jsAppWizard setup program for VC++ .NET 2003
    setup80.jsAppWizard setup program for VC++ 2005 Beta1
    Files/...WTL AppWizard for VC++ .NET 2002 and 2003 files
 
appwizCE/
    setup80.jsAppWizard setup program for VC++ 2005 Beta1
    Files/...WTL AppWizard for VC++ 2005 Beta1 files

 

 

4. Class Overview

 

usage:        mi base   -   a base class (multiple inheritance)
 client   -   wrapper class for a handle
 as-is   -   to be used directly
 impl   -   implements a window (has WindowProc) or other support
 helper   -   a helper class
 base   -   implementation base class

 

class name:usage:description:

app/module support
CAppModule app support, CComModule derived
CServerAppModule module for COM servers
CMessageLoopas-ismessage loop
CMessageFiltermi basemessage filter interface
CIdleHandlermi baseidle time handler interface

frame windows
CFrameWindowImplBase<>base 
CFrameWindowImpl<>implframe window support
COwnerDraw<>impl mi baseowner-draw msg map and handlers
CDialogResize<> impl mi basesupport for resizing dialogs

MDI windows
CMDIWindowclientMDI methods
CMDIFrameWindowImpl<>implMDI frame window
CMDIChildWindowImpl<>implMDI child window

update UI
CUpdateUIBasebase 
CUpdateUI<>mi base class provides support for UI update

standard controls
CStaticclientstatic ctrl
CButtonclientbutton ctrl
CListBoxclientlist box ctrl
CComboBoxclientcombo box ctrl
CEditclientedit ctrl
CEditCommandsmistandard edit command support
CScrollBarclientscroll bar ctrl

common controls
CImageListclient/implimage list
CListViewCtrlclientlist view ctrl
CTreeViewCtrlclienttree view ctrl
CTreeItemhelper 
CTreeViewCtrlExclientuses CTreeItem
CHeaderCtrlclientheader bar ctrl
CToolBarCtrlclienttoolbar ctrl
CStatusBarCtrlclientstatus bar ctrl
CTabCtrlclienttab ctrl
CToolTipCtrlclienttool tip ctrl
CToolInfohelper 
CTrackBarCtrlclienttrackbar ctrl
CUpDownCtrlclientup-down ctrl
CProgressBarCtrlclientprogress bar ctrl
CHotKeyCtrlclienthot key ctrl
CAnimateCtrlclientanimation ctrl
CRichEditCtrlclientrich edit ctrl
CRichEditCommandsmistd rich edit commands support
CDragListBoxclientdrag list box
CDragListNotifyImpl<>impl mi classsupport for notifications
CReBarCtrlclientrebar ctrl
CComboBoxExclientextended combo box
CDateTimePickerCtrlclientdate-time ctrl
CFlatScrollBarImplmi implflat scroll bars support
CFlatScrollBaras-isflat scroll bars support
CIPAddressCtrlclientIP address ctrl
CMonthCalendarCtrlclientmonth calendar ctrl
CCustomDraw<>impl mi classcustom draw handling support

Windows CE controls
CCECommandBarCtrlclientcommand bar ctrl
CCECommandBandsCtrlclientcommand bands ctrl

property sheet & page
CPropertySheetWindowclient 
CPropertySheetImpl<>implproperty sheet
CPropertySheetas-is 
CPropertyPageWindowclient 
CPropertyPageImpl<>implproperty page
CPropertyPageas-is 
CAxPropertyPageImpl<>implproperty page with ActiveX
CAxPropertyPageas-is 

common dialogs
CFileDialogImpl<>implGetOpenFileName/GetSaveFileName
CFileDialog as-is  
CFolderDialogImplimpldirectory picker
CFolderDialogas-is 
CFontDialogImpl<>implChooseFont common dialog
CFontDialogas-is 
CRichEditFontDialogImpl<>implChooseFont for rich edit
CRichEditFontDialogas-is 
CColorDialogImpl<>implChooseColor common dialog
CColorDialogas-is 
CPrintDialogImpl<>implPrintDlg common dialog
CPrintDialogas-is 
CPrintDialogExImplimplnew Win2000 print dialog
CPrintDialogExas-is 
CPageSetupDialogImpl<>implPageSetupDlg common dialog
CPageSetupDialogas-is 
CFindReplaceDialogImpl<>implFindText/ReplaceText
CFindReplaceDialogas-is 

USER support
CMenuclientmenu support

GDI support
CDCclientDC support
CPaintDCclientfor handling WM_PAINT
CClientDCclientfor GetDC
CWindowDCclientfor GetWindowDC
CPenclientGDI pen object
CBrushclientGDI brush object
CFontclientGDI font object
CBitmapclientGDI bitmap object
CPaletteclientGDI palette object
CRgnclientGDI rgn object

enhanced controls
CCommandBarCtrlImplimplcommand bar
CCommandBarCtrlas-is 
CBitmapButtonImplimplbitmap button
CBitmapButtonas-is 
CCheckListViewCtrlImplimplcheck list box
CCheckListViewCtrlas-is 
CHyperLinkImplimplhyper link control
CHyperLinkas-is 
CWaitCursoras-iswait cursor
CCustomWaitCursoras-iscustom and animated wait cursor
CMultiPaneStatusBarCtrlImplimplstatus bar with multiple panes
CMultiPaneStatusBarCtrlas-is 
CPaneContainerImpl<>implpane window container
CPaneContaineras-is 

additional UI components
CScrollImplimplscrolling support
CScrollWindowImplimplscrollable window
CMapScrollImplimplscrolling support with map modes
CMapScrollWindowImplimplscrollable window with map modes
CSplitterImplimplsplitter support
CSplitterWindowImplimplsplitter window
CSplitterWindowas-is 

theming support
CThemeclientWindows XP theme
CThemeImpl<>impltheming support for a window

printing support
CPrinterInfo<>as-isprint info support
CPrinterclientprinter handle wrapper
CDevModeclientDEVMODE wrapper
CPrinterDCclientprinting DC support
CPrintJobInfoclientprint job info
CPrintJobclientprint job support
CPrintPreviewmiprint preview support
CPrintPreviewWindowas-isprint preview window

miscellaneous
CSizeas-isWTL port of MFC's CSize
CPointas-isWTL port of MFC's CPoint
CRectas-isWTL port of MFC's CRect
CStringas-isWTL port of MFC's CString
CWinDataExchangemidata exchange for controls
CRecentDocumentListmi or as-issupport for MRU list

 

 

5. ATL/WTL AppWizard

 

ATL/WTL AppWizard generates starting code for a WTL application. It has options to create code for different application types and features.

 

You can choose the following options:

  • Application type (SDI, multi thread SDI, MDI, dialog based)
  • Support for hosting ActiveX controls
  • COM server support
  • Class implementation in .CPP files
  • Common Control manifest
  • Toolbar, rebar, command bar, status bar
  • View window, and it's type (generic, dialog based form, or a list box, edit, list view, tree view, rich edit based, HTML page)
  • For dialog based apps or a form based view window - support for hosting ActiveX controls in the dialog

 

ATL/WTL AppWizard supports VC++ .NET 2002 and 2003.

 

 

6. Support for Windows CE

 

WTL now fully supports building projects for the Windows CE platforms. This initial support for Windows CE was implemented primarily for eMbedded Visual C++ 4.0 with Pocket PC 2003 and SmartPhone 2003 SDKs. However, it can be used with other versions and configurations. For instance, Standard SDK 4.1 is supported as well. Considerable effort was made to provide the best Windows CE support, however, there might be some limitations because different platforms provide different programming support.

 

The support for Windows CE was not designed to port projects for the desktop version of Windows as-is to the Windows CE platforms, but to allow use of the same library, WTL, for both desktop Windows and Windows CE. Applications for Windows CE are often designed in a different way, and they use different platform services. WTL depends on the version of ATL provided with each Windows CE platform, and supports controls and services that are appropriate and supported for each Windows CE platform.

 

 

7. Notes

 

~    WTL provides several classes that are also present in ATL 7.0 and 7.1. The classes are: CSize, CPoint, CRect, and CString in atlmisc.h. While their existence will not cause any problems, their usage might. You should qualify the class you want to use with a namespace to resolve ambiguity, either ATL or WTL namespace, depending on which implementation you want to use. Alternatively, you can conditionally exclude WTL implementations, by defining preprocessor symbol _WTL_NO_WTYPES for CSize, CPoint, and CRect; and _WTL_NO_CSTRING for CString.

 

~    If you use WTL 7.5 with VC++ 6.0/ATL 3.0 and define _ATL_STATIC_REGISTRY, you'll get errors referring to the ambiguous symbol ATL. This is caused by a bug in ATL 3.0 - in atlbase.h, the file statreg.h is included inside of the ATL namespace, and it contains another namespace ATL declaration. Because of that, the compiler cannot decide between ATL:: and ATL::ATL:: namespaces. The solution is either to fix the atlbase.h, or to surround atlbase.h include declaration with following statements:

 

    #define ATL   ATLFIX

    #include <atlapp.h>

    #undef ATL

    namespace ATL = ::ATLFIX;

 

~    Windows XP allows applications to use Common Controls version 6, which supports only Unicode applications. While WTL allows creation of Ansi applications that use Common Controls 6, that should be used only for test programs and is not recommended or supported for released projects. If you want to use Common Controls 6, build your application as Unicode.

 

~    Several of the sample programs included with WTL were extended to support building for Windows CE. These samples are not specially redesigned for Windows CE, but just modified to allow you to compile and run them on the Windows CE platforms. The samples are: BmpView, GuidGen, and MTPad.

 

~    WTL supports building projects with EVC++ 3.0 only for Pocket PC and Pocket PC 2002 platforms, as other platforms don't provide minimum support for ATL or other required libraries.

 

~    The old AppWizards for VC++ 6.0 and eVC++ 4.0/3.0 are not included in this version of WTL because they cannot be a part of an Open Source project. They are still available in the previous release, WTL 7.1.

 

 

8. Changes Between WTL 7.5 And 7.1

 

New and improved:

<< TODO: Add items >>

 

Fixes and enhancements:

<< TODO: Add items >>

 

 

9. Changes Between WTL 7.1 And 7.0

 

New and improved:

VC7 Compatibility: Support for ATL7 Module classes and critical sections and AppWizard setup for VC++ 7.1

Windows CE Support: Full compatibility with Windows CE platforms and AppWizard for eMbedded Visual C++

Namespace Support: Automatic "using ATL" (ATL7 only) or "using WTL" can now be turned off

CHyperLink New Features: not underlined, underlined when hover, command button, link tags

CCustomWaitCursor class supports custom and animated wait cursors

AtlCreateBoldFont() for creating bold version of an existing font

 

Fixes and enhancements:

CFrameWindowImpl:

  • CreateSimpleToolBarCtrl() - remove dead code, improve error checking, add a global function that uses it

  • Fix - PrepareChevronMenu() fails to get toolbar strings for Unicode

  • CFrameWindowImplBase::Create() - improve ASSERT not to use m_hWnd if creation fails

  • Fix - CFrameWndClassInfo::Register - should use %p formatting only for _WIN32_WINNT >= 0x0500 or for _WIN64

  • Fix - Chevron menus not positioned correctly with RTL

  • Fix - CMDIChildWindowImpl: Problems creating maximized child windows and handling focus

  • Fix - CMDIChildWindowImpl: Should activate on WM_MOUSEACTIVATE

 

UpdateUI:

  • Fix - Incorrectly clears default item from the system menu in MDI apps

  • Added UISetCheck with bool instead of int for the check state

 

DDX:

  • Fix - Doesn't provide a way to change floating point precision

  • Added DDX_CONTROL_HANDLE for non-CWindowImpl objects

  • Added DDX_Check variant with bool instead of int for the check state

 

Command Bar:

  • Fix - OnDrawItem() and OnMeasureItem() don't do a good check for owner-draw menu items

  • Fix - Disabled 32-bit images not painted correctly in 3D menu mode

  • Fix - Popup menus not positioned correctly with RTL

  • Fix - Uses GCL_HICONSM instead of GCLP_HICONSM with GetClassLongPtr()

 

MDI Command Bar:

  • Fix - Doesn't refresh icon if MDI children are different

  • OnAllHookMessages() - improve code to handle MDI child window class icon

  • Fix - OnNcLButtonDown() uses TPM_VERPOSANIMATION without checking Windows version

  • Fix - Maximized MDI buttons in wrong place for RTL

  • Should adjust cxIdeal for rebar bands for IE4

  • Add support for different top-level menu widths by handling ideal size for rebar bands

 

AppWizard:

  • Fix - Doesn't support MSDI application as a COM Server

  • Fix - MDI with Form View - stack overflow closing maximized MDI child windows

  • Fix - Generates VERSION resource name 'test1' regardless of the project name

  • Fix - Dialog project with control hosting doesn't derive a dialog from CAxDialogImpl

  • Fix - COM Server doesn't register type library

  • Fix - COM Server doesn't register AppID properly

 

CTreeViewCtrl:

  • Fix - GetItemData() needs better return value

  • Fix - GetItemState() should use TVM_GETITEMSTATE instead of TVM_GETITEM for IE5

  • GetItem() and SetItem() - added new variants that use TVITEMEX

  • Fix - SortChildren() should add recurse flag argument

  • Fix - CTreeItem doesn't support CTreeViewCtrlExT that has different TBase than CWindow

 

CThemeImpl:

  • Fix - Uses scalar delete instead of the vector one

  • Fix - EnableThemeDialogTexture() argument is BOOL instead of DWORD

 

CFolderDialog:

  • Fix - EnableOK() passes wrong arguments to BFFM_ENABLEOK

  • Fix - Always clears m_hWnd, which causes problem for nested messages

 

CDialogResize:

  • Fix - DlgResize_Init() forces dialog to be visible by using SetRedraw()

  • Forcing WS_THICKFRAME is not enough to make dialog resizable

  • Min track size should be used for child dialogs as well

  • Fix - DlgResize_PositionControl() incorrectly checks return value from MapWindowPoints()

 

CAppModule:

  • Fix - CAppModule methods not thread-safe

  • Fix - AddSettingChangeNotify() unusable in multithreaded apps because of delayed initialization

 

CString:

  • Fix - Delete() doesn't allow deleting more than the length of the string

  • Fix - Append() can cause buffer overrun

  • Fix - MakeReverse() can cause an infinite loop

  • Fix - _cstrstr() unnecessarily inefficient

  • Fix - FindOneOf() is not DBCS-aware

  • Fix - Format() does not recognize %E

  • Fix - TrimLeft() and TrimRight() are only half-way DBCS-aware

  • Fix - May cause assertions or undefined behavior with SBCS

 

CRecentDocumentList:

  • Fix - SetMaxEntries() has an incorrect ASSERT

  • Add CString variant of the GetFromList() method

  • Add a way to replace command IDs used for the MRU list

  • Add a way to replace registry key name

 

Misc:

  • CMessageLoop::Run() - improve the loop by checking bDoIdle before calling PeekMessage()

  • CServerAppModule: Clean-up unused code

  • Fix - CServerAppModule::MonitorProc() - no need to call _endthreadex()

  • Fix - CListBox::GetText() and CComboBox::GetLBText() (CString variants) don't check for LBERR/CB_ERR

  • Fix - CAxPropertyPageImpl doesn't create ActiveX controls with ATL7

  • Fix - CDC::GetTextExtentExPoint() missing

  • CDC::SetWindowExt() should have default value NULL for the lpSizeRet argument

  • Fix - CPropertySheetWindow missing methods for PSM_INSERTPAGE, PSM_SETHEADERTITLE, and PSM_SETHEADERSUBTITLE; AddPage should return BOOL

  • Fix - CMapScrollImpl::SetScrollSize() uses wrong variable

  • Fix - CHyperLink: WM_UPDATEUISTATE causes repaint without WM_PAINT

  • Fix - CUpDownCtrl::GetPos() returns incorrect value

  • Fix - CUpDownCtrl::GetPos32() doesn't have default arg value

  • Fix - CMultiPaneStatusBarCtrl: Always uses size grip for positioning panes

  • Fix - CTabCtrl::InsertItem() should return int, not BOOL

  • CReBarCtrl: Added LockBands() method

  • Fix - CFont: uninitialized variable passed to DPtoLP

  • Fix - CPrintDialogImpl: Crash when displaying Print Setup dialog

  • Fix - CPageSetupDialogImpl::PaintHookProc() - should use T* and return UINT_PTR instead of UINT

  • Fix - CPrintJob doesn't support printing to a file

  • Fix - CSplitterImpl: Doesn't handle WM_CAPTURECHANGED - can get in an invalid state

  • CRichEditCtrl: Add method for EM_SETTABSTOPS

  • Fix - CFindFile::GetFilePath() checks for a trailing slash, but doesn't use that info

 

General:

  • Fix - Problems compiling with /Zc:forScope ('for' loop scope conformance)

  • Use named constants instead of values for pixel sizes, buffer lengths, etc.

  • Support building with Managed C++ (/CLR)

  • CMenuItemInfo - add run-time support for different versions of Windows

  • CommCtrl.h change - additional fields in IMAGELISTDRAWPARAMS now depend on _WIN32_IE instead of _WIN32_WINNT

  • Fix - Incorrect usage of CRegKey::QueryStringValue()

  • Fix - Operator = for GDI and USER wrappers leaks handle if it's managed variant

  • Fix - GDI and USER wrappers break under self-assignments

  • Fix - Chaining messages with cracked handlers broken with ATL7

  • Initialize all variables and structures prior to use

  • Use new common control struct names

 

 

10. Changes Between WTL 7.0 And 3.1

 

New classes and features:

Support for new Common Controls v6 messages

Support for Visual Studio .NET and ATL 7.0

WTLApp70 - new AppWizard for Visual Studio .NET

CThemeImpl - implements support for Windows XP themes

CMDICommandBarCtrl - implements Command Bar for MDI applications

 

Fixes and enhancements:

Command Bar:

  • Bogus assert in OnDestroy
  • Check marks can be truncated in large font settings
  • Use pT to access GetSystemSettings, DrawMenuText, DrawBitmapDisabled, Draw3DCheckmark, DoPopupMenu, DoTrackPopupMenu, TakeFocus, GiveFocusBack, so they can be overridden
  • No hot-tracking if main window is not active
  • Top level items not painted inactive if app looses activation while drop down menu is displayed
  • Added Windows XP flat menus support
  • Drop-down menu doesn't close if clicked again (Windows XP only)
  • Menu item text and accelerator text too close with some settings
  • Keyboard can still access clipped menu items
  • Added support for hiding keyboard navigation indicators until Alt key is pressed (system setting)
  • Added AddIcon and ReplaceIcon variants for icon resources
  • Image size calculated differently in different places
  • Add support for 32-bit (alpha channel) bitmaps for Windows XP
  • Fixed width calculation for default menu items

 

CFrameWindowImpl:

  • AddSimpleReBarBandCtrl sets toolbar extended styles without preserving old ones
  • PrepareChevronMenu should not create menu items for buttons with TBSTATE_HIDDEN
  • TPM_VERPOSANIMATION will not be defined in atlframe.h if atlctrlw.h is included first
  • CreateSimpleToolBarCtrl - height might be too small if large font is used
  • PrepareChevronMenu uses TB_GETBUTTONTEXT, better use TB_GETBUTTONINFO
  • Chevron menu doesn't close if clicked again (Windows XP only)
  • Should check local classes for superclassing
  • Add support for 32-bit (alpha channel) bitmaps for Windows XP

 

Update UI:

  • UISetText can clear other menu item flags
  • CUpdateUI::UIUpdateState assigns value with |= instead of =
  • Added UISetDefault() and fix default state to work with menus

 

CString:

  • GetBuffer() and GetBufferSetLength() should return NULL in out-of-memory condition
  • Added missing methods: separate c-tors for LPCSTR and LPCWSTR, CollateNoCase, TrimRight and TrimLeft variants, Find variants, moved FormatV to public
  • Fix _IsValidString usage
  • FormatV incorrectly calculates buffer size (too big)
  • Usage of _ttoi causes problems with _ATL_MIN_CRT in VC7

 

CDC:

  • GetTabbedTextExtent() should return DWORD instead of BOOL
  • Add FillRect() that accept color index instead of a brush handle
  • DrawDragRect() leaks regions and a brush
  • Improved DitherBlt() - added brushes as arguments for used colors
  • Added DrawShadowText() (uses LoadLibrary/GetProcAddress to run on older Windows)

 

CListViewCtrl:

  • SetItemState should use LVM_SETITEMSTATE
  • SetItemCount should return a BOOL

 

CRichEditCtrl:

  • Added SetCharFormat() variant that accepts flags (for SCF_ALL)
  • CharFromPos() should pass a pointer to POINTL in lParam
  • GetTextRange() - should add Unicode variant for rich edit version >= 2
  • Added another FormatRange() that can accept a pointer to FORMATRANGE (needed for passing NULL to clear cache)

 

CHyperLink:

  • Allow overriding of Navigate and CalcLabelRect
  • Doesn't handle right or center alignment

 

CColorDialog:

  • Has static variables that were not initialized with _ATL_MIN_CRT
  • Fixed HookProc for ColorOK message - the message is not sent, but the hook proc is called directly

 

atlcrack.h:

  • MSG_WM_TIMER crack macro should cast to TIMERPROC instead of TIMERPROC*
  • Add cracked handlers for all new messages in Common Controls 6

 

atlapp.h:

  • Fixed problems with atlTraceUI with ATL7
  • #ifdefs for ATL7 were in the wrong place

 

atlctrls.h:

  • Add support in control classes for all new messages in Common Controls 6

 

CRecentDocumentList:

  • AtlCompactPath corrupts memory if filename is longer than requested compact size
  • ReadFromRegistry incorrectly checks for error when reading from registry

 

CSplitterWindow:

  • Incorrect calculation of middle position
  • 3D border now drawn only if WS_EX_CLIENTEDGE is set

 

Printing:

  • Uses DWORD instead of an int for a job ID
  • CPrintJob::CancelPrintJob shouldn't have a return value

 

Misc:

  • CRegKey::QueryValue and SetValue are deprecated in ATL7
  • Added direct support for ATL7
  • Replace ScreenToClient and ClientToScreen with MapWindowPoints to support RTL layout
  • CFindFile::GetFilePath(LPTSTR...) returns path without the file name
  • MDI: Updating client edge in WM_WINDOWPOSCHANGING causes minimize/maximize/restore animation problems, use WM_WINDOWPOSCHANGED
  • Custom Draw: Added CCustomDraw::OnSubItemPrePaint() overrideable method
  • CFolderDialogImpl uses 'this' for BROWSEINFO.lParam instead of T*
  • CImageList::Destroy shouldn't use Detach()
  • ATL7 has its own AtlLoadString
  • CPropertySheet doesn't close when you press X button
  • Fixed problems for _U_STRINGorID and others that moved from atlbase.h to atlwin.h in ATL7
  • Add AtlMessageBox() that accepts either in-memory or resource strings
  • CScrollImpl: fixed bug with scrolling child windows
  • CPropertyPageImpl: Add new notification handlers to enable direct return values (use #ifdef _WTL_NEW_PAGE_NOTIFY_HANDLERS to use them)
  • Add AtlInitCommonControls() to simplify use
  • DDX: Fixed usage of the size of char arrays for DDX
  • CPageSetupDialog: changed usage of CWndProcThunk because of changes in ATL7
  • Fix confusing precedence in expressions
  • Removed forward declarations because default values for template arguments shouldn't be specified in two places (we don't need them anyway)
  • Win64: Fix /Wp64 warnings from 32-bit VC7 compiler caused by SDK headers
  • Fix direct usage of English strings (they can be #defined to something else now)
  • AtlGetCommCtrlVersion not defined if _ATL_DLL is in ATL 3.0 (and CmdBar is using it)

 

AppWizard:

  • Added manifest for Common Controls 6
  • Loading Rich Edit DLL should use HMODULE
  • Should not use atlimpl.cpp for ATL7
  • Added message handler prototypes to generated files
  • VERSION resource always has VALUE "OLESelfRegister" (now only for COM servers)
  • Added option for putting implementation in CPP files
  • d-tor for the thread manager class in MSDI project executed after the heap is destroyed
  • Wrong settings when changing to a dialog project and back (AppWizard 6.0 only)
  • Remove cut/copy/paste accelerators for form view and dialogs projects
  • Fix toolbar bitmaps so they are not transparent (problem with Windows XP flat menus only)
  • Used CMDICommandBarCtrl for MDI apps
  • Add symbols required for VC7 Class Wizard to recognize an ATL project
  • Changed default styles for the rebar, so it does look OK without CmdBar and with manifest
  • Added setup programs for both AppWizards
  • Remove ignored resource attributes: MOVEABLE, PURE, etc. (AppWizard 7.0 only)
  • Add call to DefWindowProc to WinMain to resolve possible problems if MSLU is used

 

Samples:

  • Updated toolbar bitmaps, added #ifdefs for ATL7, added manifest file for CommCtrl6, qualified _U_RECT with WTL namespace, updated use of deprecated CRegKey functions, added VC7 projects
  • Added Alpha sample

 

 

11. Changes Between WTL 3.1 And 3.0

 

New classes:

CPaneContainer - implements a window that provides a title bar and a close button (like Explorer)

CDialogResize - an MI class that allows resizing of dialogs (or any windows with child windows/controls)

CAxPropertyPageImpl - implements a property page that can host ActiveX controls

 

Fixes and enhancements:

CServerAppModule now clears m_hEventShutdown to avoid calling CloseHandle twice

 

CString:

  • operator += now leaves original string intact if it's out of memory
  • Fixed bad DWORD_PTR usage in TrimRight, TrimLeft, Replace, Remove
  • Removed dependencies on CRT for projects that don't use it
  • Insert - fixed string corruption in release builds
  • Added optional floating point formatting (for projects that use CRT)

 

CEdit and CRichEditCtrl: SetSelAll and SetSelNone had reversed implementation

 

atlres.h: Changed IDs so that they are compatible with MFC's afxres.h

 

Command Bar:

  • Added LoadMappedImages()
  • Changed handling of left and right arrow keys so that they don't close context menus
  • Add code to handle left/right arrow keys correctly on mirrored (RTL) systems
  • Removed handler that eats parent window's WM_SETTINGCHANGE
  • Fixed bitmap resource leak in Draw3DCheckmark
  • Fixed incorrect usage of CharLower in OnMenuChar
  • Fixed wrong color for the disabled items in hi-contrast mode
  • Added code to gray menu items if main window is inactive
  • Fixed keyboard mnemonic handling for IE 4
  • Fixed hook problems with multiple cmdbars in the same thread
  • Added support for radio menu items
  • Added support for disabled top-level menu items (also added in CFrameWindowImpl::PrepareChevronMenu)
  • Added keyboard shortcut (Alt+/) to invoke chevron menu
  • Added support to override menu item length in a derived class

 

CBitmapButton:

  • Bypassed BUTTON DefWindowProc for hover style so that the button doesn't take focus
  • Added BMPBTN_AUTOFIRE extended style

 

CDC:

  • Added _WTL_FORWARD_DECLARE_CSTRING define to allow usage of methods that accept CString
  • Fixed errors in GetTextFace and GetMenuItemString
  • Added GetCharWidth32
  • Added DrawIconEx method

 

CMenu:

  • Implement following missing methods:
        GetMenuDefaultItem
        GetMenuInfo
        GetMenuItemRect
        HiliteMenuItem
        IsMenu
        MenuItemFromPoint
        SetMenuDefaultItem
        SetMenuInfo
  • GetMenuString - fixed to include space for terminating NULL character in returning string

 

GDI and USER classes should destroy the GDI/USER objects in Attach if GDI/USER resource is managed

 

CFrameWindowImpl:

  • OnToolTipText shouldn't save tool tip text if it's not for a menu
  • AddSimpleReBarBandCtrl now adds chevron style only for toolbars with buttons
  • AddSimpleReBarBand(Ctrl) - calc band ID if not specified

 

CRecentDocumentList:

  • Fix - UpdateMenu deletes wrong menu item when the list is empty
  • Added code to allow restricting the number of characters displayed by MRU menu items

 

Update UI:

  • Added support for blocking accelerators for disabled items
  • Improved search code assuming there are no duplicate entries (and added checks for duplicates)

 

CSplitterWindow:

  • CSplitterWindowImpl should derive from CSplitterImpl<T , t_bVertical> to allow overriding of methods
  • Added single pane mode and SetSinglePaneMode/GetSinglePaneMode
  • Added right/bottom aligned resize mode using extended styles SPLIT_RIGHTALIGNED/SPLIT_BOTTOMALIGNED

 

atlcrack.h: Added handlers for following new messages:
    WM_APPCOMMAND
    WM_NCXBUTTONDOWN
    WM_NCXBUTTONUP
    WM_NCXBUTTONDBLCLK
    WM_XBUTTONDOWN
    WM_XBUTTONUP
    WM_XBUTTONDBLCLK

 

Win64:

  • Dialog return value should use DWLP_MSGRESULT and SetWindowLongPtr
  • CMenu::InsertMenu, AppendMenu, ModifyMenu should have UINT_PTR for the menu ID
  • Added appropriate type casts
  • CFrameWindowImpl::m_szAutoName - changed the size to fit the pointer value size
  • CListViewCtrl::SortItems should use LPARAM for user data instead of DWORD

 

Misc:

  • Added optional mask argument to all methods for setting extended styles
  • CMDIWindow::MDIRestore - fixed to send WM_MDIRESTORE instead of WM_MDIICONARRANGE
  • CListViewCtrl: Added SortItemsEx method
  • CToolBarCtrl::GetButtonInfo - fixed to return int instead of BOOL
  • Added CToolBarCtrl::SetButtonSize and SetBitmapSize that accept cx and cy instead of SIZE
  • Printing: Changed how GetNewDevModeForPage works (comments in code)
  • CFileDialogImpl::_OnTypeChange incorrectly calls pT->OnSelChange instead of pT->OnTypeChange
  • CMultiPaneStatusBarCtrl::GetPaneTipText - fixed to use index instead of and ID internally
  • CWinDataExchange: Added references to arguments of DoDataExchange, so there are no level 4 warning even if the map is empty
  • CPropertySheetWindow: Added new, IE 5.0 specific methods
  • CPropertyPageImpl: Added new, IE 5.0 specific methods

 

AppWizard:

  • added calls to RemoveMessageFilter and RemoveIdleHandler in CMainFrame::OnDestroy for COM server projects
  • added scroll bars for HTML view
  • CAppServerModule now handles -embedding as well as -automation
  • corrected code in CMainFrame::OnShowToolBar to correctly identify the toolbar in a rebar
  • dialog based app code now derives from CUpdateUI as public
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
非客户区自绘wtl版本指的是在Windows模板WTL)基础上通过自主绘制非客户区来定制界面的版本WTL是一个开源的C++模板,用于简化Windows桌面应用程序的开发。它相较于MFC更轻量级,更容易学习和使用。WTL提供了一系列的模板类和宏,可以快速开发具有Windows UI风格的应用程序。 在WTL中,非客户区(Non-Client Area)是指窗口边框以及标题栏、菜单栏、状态栏等装饰性的部分。传统上,这部分通常由操作系统负责绘制和管理。但是对于一些特殊需求,比如自定义的窗口样式、非矩形窗口等,我们需要对非客户区进行自主绘制。 非客户区自绘wtl版本即是基于WTL框架,在需要自定义非客户区的情况下,通过手动绘制实现。这种方式需要重载WTL框架中的非客户区绘制相关的函数,比如`OnNcPaint()`、`OnNcCalcSize()`等,来处理非客户区的绘制逻辑。 非客户区自绘wtl版本的好处在于可以完全控制非客户区的外观。可以根据自己的需要,实现各种特殊的样式和效果,如渐变色、图案填充、自定义按钮等。这样可以使应用程序更加美观和独特,增强用户体验。 但是非客户区自绘wtl版本也存在一些挑战。首先,自绘非客户区需要较高的绘制技术和图形处理能力。其次,自绘非客户区还会涉及到一些与系统相关的问题,如窗口移动、窗口关闭等操作的处理。因此,需要对WTL框架有较深入的理解和熟练的编程技巧。 总之,非客户区自绘wtl版本是在WTL框架基础上,通过自主绘制实现自定义非客户区的一种方式。它可以让我们灵活控制非客户区的外观,提升应用程序的美观程度和用户体验。然而,也需要考虑到相关的技术和系统问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值