Application Types You Can Create with Visual C++Visual C++ .NET comes with a package of wizards that generate starting code for a wide variety of applications, both managed and unmanaged. A useful way to categorize these applications is by their user interface:
Table 2.1 categorizes the applications that Visual C++ .NET 2003 will create for you. Table 2.1. Application Types in Visual C++
If you took "Intro to C++" at college or were sent on a one-week C++ course, you almost certainly wrote console applications. These applications use the iostream library ( cin and cout , for example) to write characters (not graphics) to the screen and read them from the keyboard. They generally can't interact with the mouse. Although this might seem hopelessly out of date, console applications serve a very useful purpose as test harnesses, discussed in the next section. Managed console applications can use the System::Console class (with methods ReadLine , WriteLine , and the like) rather than the iostream library, and they need the .NET Framework installed on the machine where they will run. The excitement over .NET connected applications, built on Web Services or leveraging the power of ASP.NET, has obscured the very real role of Windows applications in the lives of most computer users. Think about the products you use every day: Word, Excel, even Notepadthey're all Windows applications. They can read from and write to your local hard drive, communicate with local printers, and they are probably the workhorses of your day. Visual C++ .NET 2003 can be used to create Windows applications that require the .NET Framework to run, as you'll see in Chapter 4, "Building Simple User Interfaces with Windows Forms." Alternatively, you can build unmanaged Windows applications that run directly under Windows using the MFC library. Web applications are accessed through a browser. When the Web server is asked for a specific page or URL, it runs your code to generate the HTML that is returned to the browser. Unmanaged Web applications, which run through ISAPI or through ATL Server, are very high-performance solutions to specific problems. Your code must manually generate any output HTML, so typically the user interface is not visually complex, although of course you can generate any HTML you want. Developers who use VB.NET or C# can create ASP.NET applications for a rich user experience with code that runs on the Web server, but that option is not available to Visual C++ .NET 2003 developers. Services generally don't have a user interface. They can start when the computer startseven if no one has logged inand are controlled from the Services section of Computer Management. They are typically used by other applications or to interact with the operating system. Chapter 12, "Writing a Windows Service," has more details. Web Services are similar to services but, like Web applications, respond to requests directed to a Web server. Unmanaged Web Services can be created with the ATL Server and managed Web Services can be created with ASP.NET. Managed Web services don't require the framework on machines that use the service, but they do require it on the Web server. Learn more about managed Web Services in Chapter 10, "Writing and Consuming a Web Service." Class libraries are also destined to be called by other applications. Most large applications are separated into layers or tiers , and each of these layers is typically implemented as a class library, except for the user interface layer which is a Windows or Web application. As a result, many developers spend more time developing class libraries than any other kind of application. Visual C++ developers can create unmanaged DLLs, unmanaged COM components, and .NET class libraries. Chapter 5, "Writing a Class Library in Unmanaged C++," discusses some of the architectural concepts involved in designing class libraries and the layers of your application for maximum interoperability. Chapter 6, "Writing a Class Library in Managed C++," describes how simple it is to write code that can be used from any .NET language. Chapter 7, "Building DLLs in Unmanaged C++," and Chapter 8, "Writing COM Components In C++," describe two ways of making a unit of code available to both the managed and unmanaged world, while working in unmanaged C++. |