Product Changes: Visual C++ .NET 2002

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see What's New in Visual C++.

Microsoft Visual C++ .NET 2002 provides many new features and improvements:

  • Managed Code and Targeting the .NET Framework

  • Attributed Programming

  • Visual C++ Compiler, Linker, and Visual C++ Language

  • Development Environment

  • Resource Editors

  • Libraries

  • Deployment and Redistribution of an Application

  • Visual C++ .NET Samples

Managed Code and Targeting the .NET Framework

Visual C++ introduces two ways for you to write managed code. Both are designed to make COM programming easier and to allow your programs to access the services provided by the .NET common language runtime, such as garbage collection and language interoperability.

  • Managed Extensions for C++   By using these extensions, you can continue writing C++ code in existing programs.

  • Visual C#   C# is a new programming language that is simple, type safe, and object oriented. An evolution of C and C++, C# is designed for developers to create new .NET Framework applications.

Attributed Programming

Attributes are designed to provide an efficient and quick method to simplify COM programming in Visual C++. Attributes, like C++ keywords, are used in your source files and interpreted by the compiler. Attributes can modify the behavior of your existing code and even insert additional framework code to accomplish basic tasks, such as implementing an ActiveX control, creating a class factory, or formatting a database command. You can apply attributes to nearly any Visual C++ object, such as classes, data members, and member functions, or you can insert attributes into your source code as stand-alone statements.

Visual C++ Help includes attributes walkthroughs that cover various aspects of attributed programming.

Visual C++ Compiler, Linker, and Visual C++ Language

The following compiler, linker, other build tools, and Visual C++ language features are new for Visual C++ .NET. There is also an update to the Standard C++ Library.

Compiler

  • Standard compliance issues in Visual C++.

  • /AI compiler option.

  • /clr compiler option.

  • /FU compiler option.

  • /Fx compiler option.

  • /GH compiler option.

  • /Gi compiler option was removed from the compiler; the Visual C++ compiler no longer does incremental compilation. /Gi will be silently ignored by the compiler.

  • /GD compiler option was removed from the compiler.

  • /GL compiler option.

  • /GS compiler option.

  • New keywords associated with Managed Extensions for C++.

  • /Qlfist is now documented.

  • /O1 and /O2 now use /GF instead of /Gf.

  • /Ox, /O1, and /O2 now use /Ob2 instead of /Ob1.

  • /RTC compiler option.

  • /showIncludes compiler option.

  • /w compiler option now lets you specify the behavior of specific warnings.

  • /Wall compiler option now lets you enable all warnings, including warnings that are disabled by default.

  • /WL compiler option.

  • /Wp64 compiler option.

  • /Y- compiler option.

  • /Zc:forScope compiler option.

  • /Zc:wchar_t compiler option.

  • A list of warnings that are off by default.

  • Boolean expressions are now of type bool, not BOOL.

Linker

  • /ALLOWBIND linker option.

  • /ASSEMBLYMODULE linker option.

  • /ASSEMBLYRESOURCE linker option.

  • /COMMENT linker option is now deprecated. Use the comment pragma.

  • The CVPACK utility is removed.

  • /DEBUGTYPE linker option has been removed. Symbol support in COFF format is removed; symbols must now be placed in .pdb files.

  • /GPSIZE linker option has been removed. The linker now determines the optimal location for communal variables (uninitialized global data items) based on the presence of GP relative relocations to the data.

  • /IDLOUT linker option.

  • /IGNOREIDL linker option.

  • /LINK50COMPAT has been removed. Import libraries created with Visual C++ .NET are compatible with Visual C++ 6.0.

  • /LTCG linker option.

  • /MAPINFO:FIXUPS has been removed.

  • /MIDL linker option.

  • /NOASSEMBLY linker option.

  • /PDB:NONE linker option has been removed. Debug information in the .exe is no longer supported.

  • /PDBSTRIPPED linker option.

  • /PDBTYPE linker option has been removed. Debug information will be placed in a single .pdb file.

  • The /PROFILE linker option has been removed. If you are using a third party profiler that needs /PROFILE, you should instead use /FIXED:NO. In this version, the linker will still accept /PROFILE as a synonym for /FIXED:NO.

  • The source profiler, a linker utility, is removed.

  • /TLBID linker option.

  • /TLBOUT linker option.

  • /TSAWARE linker option.

  • /WARN linker option has been removed.

Dumpbin

  • /CLRHEADER option.

  • /IMPORTS option for the DUMPBIN utility now takes an optional parameter that lets you display imports from a specified DLL.

  • /PDBPATH option.

  • /RAWDATA parameters are renamed, but syntax from previous releases is still valid.

  • /UNWINDINFO option.

Visual C++ Language

  • _AddressOfReturnAddress keyword is now documented.

  • __alignof keyword.

  • Covariant return types are now supported.

  • __declspec(align) keyword.

  • __declspec(deprecated) keyword.

  • __declspec(noinline) keyword.

  • __declspec(selectany) keyword now supports dynamically allocated objects (objects initialized by a constructor).

  • __event keyword.

  • The for statement under /Ze has been modified to adhere more closely to standard behavior.

  • __if_exists and __if_not_exists keywords.

  • __interface keyword.

  • Function-try blocks are now supported.

  • __m64 data type.

  • __m128 data type.

  • __m128d data type.

  • __m128i data type.

  • MMX, SSE and SSE2 intrinsics.

  • __super keyword.

  • template keyword now allows template parameters.

  • throw(...) syntax.

  • __assume compiler intrinsic.

  • __debugbreak compiler intrinsic.

  • __noop compiler intrinsic.

  • Explicit overrides.

  • Limit on levels of nested parentheses in a single expression is now 256.

  • _ReturnAddress keyword is now documented.

  • __sealed keyword.

  • __w64 keyword.

  • wchar_t is now a native data type.

  • New keywords associated with Managed Extensions for C++.

Preprocessor

  • conform pragma.

  • __COUNTER__ predefined macro.

  • deprecated pragma.

  • __FUNCDNAME__ predefined macro.

  • __FUNCSIG__ predefined macro.

  • __FUNCTION__ predefined macro.

  • #import directive:

  • You can now specify type libraries by progid or libid.

  • The following are new attributes in the #import directive:

    • embedded_idl

    • no_dual_interfaces

    • no_smartpointers

  • _MANAGED preprocessor directive.

  • managed and unmanaged pragmas.

  • pack pragma now has a show option to display current pack value.

  • pop_macro is now documented.

  • push_macro is now documented.

  • runtime_checks pragma.

  • section pragma.

  • #using directive.

  • _WCHAR_T_DEFINED preprocessor directive.

Development Environment

The following development environment features and changes are new for Visual C++ .NET.

  • Class View has been extended.

  • Excluding Files When Dependency Checking (new procedure).

  • The Properties window provides a customizable grid for viewing and modifying properties of objects in your project.

  • Project property pages let you specify build settings for projects.

  • Wizards are now designed in HTML and JScript, with supporting text files, to make custom wizards more flexible and extensible.

  • WizardBar and ClassWizard have been removed.

  • Customizing the build process is a new pre-build event.

  • The New Database Wizard has been removed from Visual C++ .NET.

  • Exporting an NMAKE makefile is no longer available. Use devenv command line switches to build a Visual C++ project from the command line.

  • Visual C++ 6.0 projects that use /Gf and that are imported into the new version will have their /Gf options converted to /GF.

Resource Editors

Image Editor Toolbar and the Option Selector

The Image Editor toolbar was called the Graphics toolbar in Visual C++ 6.0. While the buttons on the toolbar are essentially the same (tools for drawing, painting, entering text, erasing, and manipulating views), the behavior and presentation of the toolbar has changed slightly.

In Visual C++ 6.0, the Graphics toolbar was initially a docked window on the left side of the workspace and the Options selector appeared as a box within the toolbar. In Visual C++ .NET, the Image Editor toolbar appears at the top of the workspace. The Option selector now appears on the far right in the Image Editor toolbar as a button with a drop-down arrow. The icon on the Option selector button changes depending on the tool you have selected.

The Text Tool Dialog Box on the Image Editor Toolbar

The behavior of the Text Tool dialog box has changed from Visual C++ 6.0 to Visual Studio .NET.

Action

Result in Visual C++ 6.0

Result in Visual Studio .NET

Press ENTER

Entered new line into text.

Exits the Text tool and commits the changes.

Click the Close button

Exited the Text tool and committed the changes.

Exits the Text tool and commits the changes.

Press ESC

Exited the Text tool and committed the changes.

Exits the Text tool and discards the changes.

Press SHIFT + ENTER

(Not applicable)

Enters a new line into text.

Press CTRL + ENTER

(Not applicable)

Enters a new line into text.

These changes make the Text tool behave more like standard dialog boxes and the other Image editor tools.

Libraries

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see What's New in Visual C++.

The following libraries included in Visual C++ .NET are either new or have changed.

Active Template Library (ATL)

  • The default settings for ATL projects have changed.

  • More reference topics for ATL methods contain code examples.

  • Support for collections and enumerators: ICollectionOnSTLImpl, IEnumOnSTLImpl, CComEnumImpl, CComEnumOnSTL, CComEnum

  • A new class, CImage, that provides enhanced bitmap support, including the ability to load and save images in JPEG, GIF, BMP, and Portable Network Graphics (PNG) formats.

  • New classes for managing arrays, lists and trees: CAtlArray, CAtlList, CAtlMap, CRBMap, and CRBMultiMap.

  • New string conversion macros and classes.

  • Utility classes: CAdapt

  • Hosting ActiveX controls: IAxWinAmbientDispatch, IAxWinHostWindow, CAxWindow2

  • Enhancements to CComBSTR and CComVariant

  • New macros: OBJECT_ENTRY_AUTO and OBJECT_ENTRY_NON_CREATEABLE_EX_AUTO

  • Simplified object creation: CComCoClass::CreateInstance

  • Improved debugging support: _ATL_DEBUG_INTERFACES

  • Registry support for REG_MULTI_SZ values: CRegKey

  • New security classes: CAcl, CDacl, CSacl, CSecurityAttributes, CSecurityDesc, CSid, CTokenGroups and CTokenPrivileges.

  • New array management classes: CSimpleArray, CSimpleMap, CComSafeArray, CComSafeArrayBound.

  • A Currency object class: CComCurrency.

  • The following ATL macros should be considered obsolete: atlTraceFlags, ATLTrace, BEGIN_OBJECT_MAP, OBJECT_ENTRY, END_OBJECT_MAP.

  • Several ATL methods have been replaced.

  • The functionality of CComModule has been distributed into several new classes.

ATL Server

ATL Server is a set of native C++ classes that allows developers to create Web applications, XML Web services, and other server applications. Many classes can also be used in client applications or components.

C Run-Time Library

  • Run-time error checks functions

  • The new operator can throw an exception or return zero if the memory allocation fails.

  • Recover from stack overflows with _resetstkoflw

  • New functions to allow dates beyond the year 2038:

    _ctime64

    _wfindnext64

    _gmtime64

    _wstat64

    _wctime64

    _fstat64

    _localtime64

    _time64

    _findfirst64

    _ftime64

    _mktime64

    _utime64

    _wfindfirst64

    _futime64

    _stat64

    _wutime64

    _findnext64

     

     

     

  • Configure debug-heap checks with _CrtSetDbgFlag.

  • Determine block and subblock types _CrtReportBlockType

  • Math constants

  • New wide-character functions:

    _cwprintf

    _putwch

    _putws

    _wtof

  • New __int64 versions of string functions:

    _strtoi64

    _strtoui64

    _wctoi64

    _wcstoui64

  • New Unicode versions of console functions:

    _getwch

    _ungetwch

    cgetws

    _getwche

    _cwscanf

     

     

     

  • New string functions that calculate the number of characters needed to print formatted data:

    _scprintf

    _scwprintf

    _vscprintf

    _vscwprintf

    _snscanf

    _snwscanf

     

     

  • Data alignment functions.

  • _set_security_error_handler, for registering a security error handler.

  • Because the timing of the release of C99, this version of Visual C++ is not conformant with that standard.

  • New byte-swapping functions: _byteswap_uint64, _byteswap_ulong, _byteswap_ushort.

  • _set_SSE2_enable to use SSE2 instructions.

  • _CrtSetReportHook2.

Microsoft Foundation Class (MFC) Library

  • Reference topics for MFC contain hundreds of new code examples.

  • Static Casting and MFC Message Maps   Beginning with Visual C++ .NET, MFC provides stricter type checking for return and parameter types of message handler functions. This new behavior notifies the developer of potential problems by flagging potentially unsafe message handlers with an error message. MFC now uses static casts for ON_MESSAGE, ON_REGISTERED_MESSAGE, ON_THREAD_MESSAGE, and ON_REGISTERED_THREAD_MESSAGE.

    For example, in the past a developer could use a member function that returned void instead of LRESULT for ON_MESSAGE or ON_REGISTERED_MESSAGE and compile without any errors. With Visual C++ .NET, the potential miscast is caught and flagged as an error. The developer can fix the potential problem by replacing the return type (with LRESULT) and recompiling.

  • DHTML editing component: CHtmlEditCtrl, CHtmlEditView, CHtmlEditDoc

  • DHTML dialog boxes: CDHtmlDialog, CMultiPageDHtmlDialog

  • ISAPI support for parsing argument lists: CHttpArg, CHttpArgList

  • Support for windowless controls: COleControlSite, COleControlContainer, and COccManager

  • Enhanced support for using HTML Help in an MFC application.

  • Windows 2000 print property sheet: CPrintDialogEx.

  • DAO support: The Visual C++ MFC Application Wizard and MFC DLL Application Wizard no longer support DAO database projects. You can still add DAO-derived classes using the Add Class Wizard. Microsoft recommends using OLE DB or ODBC for new native C++ projects. You should use DAO only in maintaining existing applications.

  • TRACE0, TRACE1, TRACE2, and TRACE3 are now considered obsolete; use ATLTRACE2. TRACE now has the same functionality as ATLTRACE2.

  • When selecting a dialog box font, use MS Shell Dlg, not MS Sans Serif or Helv fonts. Previous versions of MFC would automatically replace MS Sans Serif or Helv with DEFAULT_GUI_FONT or the system font, but MFC no longer does that.

  • Enhanced support for localized resources in satellite DLLs.

OLE DB Templates

The following OLE DB Templates are provided in Visual C++:

  • New consumer classes: CDataConnection, CDynamicAccessor, CDynamicParameterAccessor, CDynamicStringAccessor, CDynamicStringAccessorA, CDynamicStringAccessorW, CStreamRowset, CXMLAccessor.

  • New consumer macros: COLUMN_NAME* macros for binding to a specific column in the database by name and BLOB* macros for binding binary large objects (BLOB).

  • New provider classes: IDBSchemaRowsetImpl, IErrorRecordsImpl, IRowsetChangeImpl, IRowsetCreatorImpl, IRowsetNotifyCP, IRowsetNotifyImpl, IRowsetLocateImpl, IRowsetUpdateImpl.

New 64-bit Data Types

Methods in several OLE DB Templates classes have been changed to use the new 64-bit data types instead of the old 32-bit ones. The documentation has been updated to reflect these changes. In case of discrepancy between the documentation and the header files (atldb.h, atldbcli.h, and atldbsch.h), the header files contain the most current parameter types.

Shared Classes

A number of new and revised classes can now be used in any Visual C++ program.

Standard C++ Library

The Standard C++ Library has been updated:

  • hash_map Class

  • hash_set Class

  • Optional exception handling support.

  • Enhanced code formatting (readability).

  • Enhanced DLL support (passing objects between process boundaries).

  • Enhanced multithreading support.

  • Enhanced compliance with the standard.

Old iostream Library

For Visual C++, the use of the old iostream library is deprecated; you will get a warning each time you use an iostream function. It is possible that the old iostream library will be removed in a subsequent release.

Deployment and Redistribution of an Application

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see What's New in Visual C++.

To redistribute a Visual C++ application, you can use deployment in Visual Studio, which allows you to create setup executables, packaging files, and publish to Web sites.

If you do not want to use Visual Studio deployment and you have a native (not managed) Visual C++ application, you can discover your application's dependencies and develop your own setup process.

Visual C++ .NET Samples

Note

Some features mentioned in this topic may not still exist in the current version of Visual C++. For more information, see What's New in Visual C++.

Visual C++ .NET includes all new samples for the following areas:

  • C Run-Time Library

  • ATL Server

  • Attributes

  • Managed Extensions for C++

  • MASM

  • Debugging

  • Custom Wizard

    Note

    Because the wizard architecture has changed, the samples previously provided for Custom Wizards were retired, and new Custom Wizard samples have been provided.

  • Code Model

  • Project Model

  • Event Handling

  • International

  • Tailspin Toys Application

Additionally, Visual C++ .NET includes new samples for the following areas plus the samples that shipped in previous releases:

  • MFC

  • ATL

  • COM support

  • Standard Template Library (STL)

See Also

Other Resources

Product Changes in Visual C++ Releases