Search and Find
.NET Application Development Realms (S. 48-49)
.NET application development falls primarily into one of five realms: Web applications, Web services, Windows applications, Windows services, and console applications. Using languages such as C#, Visual Basic 2008, and C++/CLI in conjunction with Visual Studio provides a simple, powerful, and consistent environment to develop all five. Unfortunately, for C++/CLI, only four are supported completely: console applications, Windows applications, Windows services, and Web services. Web applications, though supported, takes a little more effort.
In the previous version of this book I said that coding a Web application was not possible. I later found out I was wrong and I will show you how in Chapter 17. Console Applications Console applications are basically extinct as a final software delivery in the Windows world. Okay, developers and administrators still use them a lot, but the average nontechnical user has GUI-based applications as their final delivery. For developer tools, there is nothing like them. If you need to figure out how to do something, write out a console application.
There is nothing simpler and nothing with less overhead. This book is full of console applications for just those reasons. The key elements of all console applications are the main() function and the System::Console::WriteLine() method. In fact, that is almost all you need to write a console application. Windows Applications Windows applications may be the biggest change for C++/CLI programmers. C++/CLI does not directly support the Microsoft Foundation Class (MFC) library. Wow, don’t panic—believe it or not, the .NET Framework has a better solution. It’s called Windows Forms, and I’m sure you’ll think, as I do, that it’s a godsend. With Windows Forms, you get the ease of Visual Basic along with the power of C++/CLI when you develop Windows applications. I cover Windows applications in Chapters 10 and 11.
Since .NET version 2.0, you can use MFC and Windows Forms somewhat interchangeably, but if you do, the generated assembly will be classified as unsafe. When you create Windows Forms, you will use the massive System::Windows::Forms namespace. Though this namespace is large, it is consistent and well laid out. It will not take you long to get good at using it.
Just to add some variety to your Windows applications, .NET also provides a new and improved Graphical Device Interface (GDI) called, conveniently, GDI+. With GDI+, you can play with fonts, change colors, and, of course, draw pictures. GDI+ is almost worth learning just for one class, System::Drawing::Image, which allows an application to load almost any commonly supported graphic file formats, including GIF, JPEG, and BMP, into memory, where they can be manipulated and drawn to the screen. To implement GDI+ in the .NET Framework, you need to explore the System::Drawing namespace. I cover GDI+ in Chapter 12.