Visual C++ 2005 IDE Enhancements, Part 6: Protect Against Buffer Overruns with the /GS Switch, Page 2
The Server Explorer in Visual Studio 2005 has had a number of incremental updates to the version that shipped with Visual Studio 2003. For those who haven't used the Server Explorer, it serves a similar role to Microsoft Management Console applets in that it allows local and remote server components such as SQL Server and Biztalk to be managed and accessed.
One of the more important additions to the Server Explorer is the out-of-the-box inclusion of WMI Classes and Events. WMI is one of the real hidden gems in Windows, and allows an application to query or respond to a huge range of data relating to the hardware and configuration of a computer. WMI can answer questions and perform tasks as diverse as determining the chemistry and charge remaining of the batteries of a laptop, the ability to join a computer to a domain or workgroup, and the various options that were chosen during the installation of an MSI package.
The ability to view WMI classes and events, which are called Management Classes and Events in the Server Explorer view (see Figure 4), was offered via a Server Explorer extension in Visual Studio.NET 2003 (which can be downloaded from here), and now is thankfully available with a standard Visual Studio install. What makes the WMI functionality in the Server Explorer even more useful in Visual C++ 2005 is the ability to drag and drop a WMI object directly onto a design surface in a C++/ CLI project. The drag and drop support comes compliments of the improved CodeDOM implementation that C++/CLI offers over Managed C++, as covered in a previous article. Dragging a WMI object onto a design surface will generate a header file with the necessary helper methods to easily connect to the WMI object using strongly typed classes auto-generated from the WMI schema.
Figure 4: Visual Studio 2005 Server Explorer with Management Events expanded
One of the new options in Visual Studio 2005 is the ability to create a project from an existing group of files and folders. Although this new functionality is not a huge breakthrough, and this task can be accomplished in previous versions of Visual Studio by creating a new project of the correct type and importing all the required files, it does save a considerable amount of tedious work for large applications. Creating a new project based on existing source code files is initiated by the File | New | Project from Existing Source... menu item, and following the wizard. One of the key benefits of the new project creation wizard is the ability to import all the files from a folder and its sub-folders based on a wild-card search path, which is especially important for large C++ applications that tend to use folders to separate areas of functionality in a source code tree.
The project creation wizard supports the use of Visual Studio as a build system, or custom build, rebuild, and clean command line tools can be nominated. The wizard also allows the user to select the appropriate project type, and some of the main build settings can also be created.
Answers to Questions
Q. Does the editor now support separate coloring of virtual space (in other words, "space" beyond the end of line)?
A. There doesn't appear to be any setting that can control the coloring of virtual space. There are dozens of items in the Display Items listbox in the Options dialog on the Environment | Fonts and Colors page, but none relate to this item.
Q. Can it support highlighting for text file with customized file extension and with customized syntax definition file?
A. Custom file extensions can be mapped to a particular language using the Options dialog box in Visual Studio. On the Text Editor| File Extensions page, enter the custom file extension, and associate it with Visual C++. There is also the option of mapping all extension-less files to a particular language, as shown in Figure 5.
Figure 5: Visual Studio 2005 Server Explorer with Management Events expanded
Adding support for a custom syntax definition requires the use of the Visual Studio SDK (formerly VSIP SDK). Check out the Visual Studio Extensibility Center at http://msdn.microsoft.com/vstudio/extend/ for more details.
About the Author
Nick Wienholt is an independent Windows and .NET consultant based in Sydney, Australia. He is the author of Maximizing .NET Performance from Apress, and specializes in system-level software architecture and development with a particular focus on performance, security, interoperability, and debugging. Nick can be reached at NickW@dotnetperformance.com.
Page 2 of 2