March 21st, 2007

MFC Updates for Vista Common Controls

MFC has been updated for Visual Studio codename Orcas to handle the new common controls/messages/flags added in Windows Vista.  We have made a number of updates to MFC to wrap the new controls and messages, so when you’re using these new capabilities, MFC will make it easier to code them.

 

Three new MFC classes have been added to wrap new controls (from Windows XP and Vista):

·        The CPagerCtrl MFC class wraps a ‘SysPager’ control window.  The pager control is a control container which has scrollers, so it can contain more controls than there is visible space for.

·        The CNetAddressCtrl MFC class wraps a ‘msctls_netaddress’ control window.  The network address control is essentially an edit control with network address validation built in, so IPv6, IPv4, and DNS names can be validated by the control rather than by user code.

·        The CSplitButton MFC class wraps a button window when it has the BS_SPLITBUTTON style.  This is a button with a drop-down attached, so variants of a command can be added to a drop-down menu attached to the button.

 

Several MFC classes have been updated with methods to wrap new messages (from Windows XP and Vista):

·        The CMonthCalCtrl class has 19 new methods, including support for setting various calendar views(month/year/decade/century) and support for calendar borders.

·        The CButton class has 15 new methods, including support for the “split-button” and “command-button” styles in Vista.

·        The CTreeCtrl class has 15 new methods, including support for expanded images and extended item states.

·        The CListCtrl class has 14 new methods, including complete support for group methods and item-index methods.

·        The CToolBarCtrl class has 9 new methods, including support for padding and pressed image lists.

·        The CProgressCtrl class has 8 new methods, including support for marquee mode, colors and states.

·        The CEdit class has 7 new methods, including support for “highlighting” behavior added in Vista and “cue banner” behavior added in Window XP.

·        The CComboBox class has 5 new methods, including support for “cue banner” behavior added in Windows XP.

·        The CDateTimeCtrl class has 5 new methods, including support for changing the style of the child calendar control.

·        The CHeaderCtrl class has 5 new methods, including support for a dropdown from the column header.

·        The CReBarCtrl class has 4 new methods, including support for setting band width and extended styles.

·        The CToolTipCtrl class has 4 new methods.

·        The CSliderCtrl class has 2 new methods.

·        The CStatusBarCtrl class has 1 new method.

·        The CAnimateCtrl class has 1 new method.

·        The CLinkCtrl class has 1 new method.

 

MFC has been updated to handle the new Vista Aero “look-and-feel”.  This includes support for automatically or manually hiding the main menu bar in an application, which is suggested if other UI elements such as toolbars duplicate most of the UI in the main menu bar.

 

MFC has also been updated to use the new file opening and saving dialogs that are the standard in Vista.  This is as simple as recompiling your application with MFC.  If you are using CFileDialog to get an open or save dialog, your application will automatically use the new Vista dialogs and gracefully degrade to using the old dialogs on previous versions of Windows.

 

That pretty much covers the updates to MFC.

 

Also note that Spy++ has also been updated to handle the new Vista controls and messages, so you can use it effectively in tandem with MFC.  An article about those updates will be posted soon.

 

Thanks, and we welcome any questions you might have about MFC, or feature requests for future versions.

 

Pat Brenner

Visual C++ Libraries Team

Category
C++
Topics
DevMFC

0 comments

Discussion are closed.