Writing Your Applications with Visual Studio .NET on Windows XP Professional
Summary: This article discusses the productivity benefits of developing application software on Windows XP using Visual Studio .NET. (9 printed pages)
Windows XP Professional: The Developer Operating System
Are you constantly on the lookout to improve your professional productivity and the productivity of your development organization as a whole? If so, immediately adopting Microsoft® Windows® XP Professional for your application development platform should be very high on your To Do list. Here's why.
Greater Reliability and Performance => Higher Developer Productivity
There are multiple contributing factors to the greatly improved reliability and performance of Windows XP as compared with earlier Microsoft operating systems.
As compared with Windows 98 and Windows NT 4.0
Tired of crashing your desktop when you test your latest changes? If you are developing applications for the Windows 9x platform, you may have concluded that you are stuck on that platform yourself. Think again. Yes, you have to test on all the platforms you support, but Windows XP is one of those platforms!
Therefore, instead of developing on Windows 9x and relegating Windows XP to one of the configurations you test in your lab, why not develop on Windows XP and test Windows 9x in the lab? It's a very good bet that most of the bugs you encounter on Windows 9x will repro on Windows XP, allowing you to spend the great majority of your time in the more productive development environment of Windows XP.
How much more reliable is Windows XP? Last year the National Software Testing Laboratory concluded that Windows 2000 Professional is 13 times more reliable than Windows 98 and three times more reliable than Windows NT® 4.0 Workstation. Read the details at this Microsoft Web site. New reliability tests of Windows XP are underway that are expected to improve on the Windows 2000 foundation.
How much faster is Windows XP? eTesting Labs Inc. found Windows XP to be overall the fastest version of the Windows operating system ever created for a wide range of desktop computing tasks. For example, as explained in this report, average application startup times in Windows XP improved by 25 percent over Windows 98, translating directly into faster build cycles for you.
As compared with Windows 2000
Many of the kernel improvements in Windows XP that address performance and reliability are available to Windows 2000 desktops via Service Pack updates. Similarly, many of these improvements that result from including the latest device drivers are available by downloading and installing the latest drivers from the appropriate PC peripheral manufacturer's Web site.
So, if you are already running Windows 2000 and keeping your system up-to-date, a decision to upgrade to Windows XP predicated primarily on increasing your development platform reliability and performance may be close to a wash.
Still, you might be swayed by all the additional reliability features that have been added to Windows XP.
New reliability features
Windows XP builds on the Windows 2000 foundation by adding a number of new, higher-productivity features aimed squarely at reducing the number of critical problems that occur. These features create faster and easier problem resolution and provide a more reliable personal computing experience.
The article Reliability Improvements in Windows XP Professional discusses the new productivity features added to Windows XP (including links to even more details), such as the Windows Driver Protection feature that protects you from installing and loading defective drivers, as well as the Device Driver Rollback features that represent a huge productivity improvement over the Last Good Known Configuration option in Windows 2000 and Windows NT. This article also reviews the Dynamic Update option in Windows Setup that can automatically pick up the latest Setup updates from the Windows Update site.
Related links:
Fast User Switching
Fast User Switching is a new feature of Windows XP that builds upon the Windows 2000 infrastructure for the separation of user state and data settings. The primary productivity advantage derives from your new ability to test application features on the same computer using multiple, simultaneously logged-on user profiles. To do this without Windows XP requires multiple machines or lots of time-consuming log-off and reboot cycles.
Thus, it is possible to create multiple user profiles with differences running the gamut of language and accessibility settings to different network or local computer resource access privileges.
A variety of programming guidelines that may be applicable to your particular application scenario are discussed in the related links below.
Related links
- Platform SDK: Policies and Profiles documentation on Fast User Switching.
- Platform SDK: Shell Programmer's Guide documentation on User Accounts with Fast User Switching and Remote Desktop.
- Platform SDK: Application Compatibility Guide documentation on Test Your Application with Fast User Switching.
- Platform SDK: Real-time Communication (RTC) documentation C++ coding example on Fast User Switching with RTC.
- Windows XP Networking Features and Enhancements.
Isolated Applications and Side-by-Side Assemblies in Windows XP and the .NET Framework
The Windows XP approach to isolated applications and side-by-side assemblies represents a significant advance over the side-by-side sharing and dynamic-link library (DLL) redirection introduced in the Windows 98 Second Edition/Windows 2000 timeframe. These earlier implementations recommended that developers build new components supporting the simultaneous execution of multiple versions of that component. This relied upon using the registry, so components were not fully isolated. In the event of a registry conflict, applications could still be broken.
With Windows XP, the assembly is described by a manifest; the registry is no longer relied upon for storing and accessing the COM activation data. This allows components to now be fully isolated from each other. Shared assemblies can now be serviced as well—unlike statically linking DLLs, the Windows XP configuration enables assembly publishers, application publishers, and administrators to change side-by-side assembly dependencies after deployment. Windows XP provides a model for safely servicing assemblies and managing which side-by-side assemblies an application uses.
These concepts of isolating applications, usage of assemblies, manifests, explicit version management, and servicing with configuration are also fully supported in the .NET framework. Just like the Windows XP implementation, the Common Language Runtime in .NET enforces requests for specific versions by providing a default version, or by honoring publisher overrides per assembly and administrator overrides per system. Also, using services provided by the Common Language Runtime, Visual Studio® .NET automatically creates manifests during code development.
Related links
- How To Build and Service Isolated Applications and Side-by-Side Assemblies for Windows XP.
- Simplifying Deployment and Solving DLL Hell with the .NET Framework.
- Side-by-Side and Versioning Considerations for .NET Remoting.
- Platform SDK: Isolated Applications and Side-by-Side Assemblies.
Stored User Names and Passwords
When you log on to a computer running Windows XP Professional, you supply a user name and password that becomes your default security context for connecting to other computers on networks and over the Internet. However, many users have cases in which they need to use different names and passwords for connecting to different resources. Examples could include:
- You want to log on to your computer with a standard account but connect to certain computers as an administrator for maintenance and troubleshooting reasons.
- You work at home and want to use your work user name and password to connect to work-related servers.
- Your account is in a domain and you need to access computers in an untrusted domain.
- You want to access Web sites with user names and passwords specific to each of those sites.
You can access the user interface to manage your stored credentials in the Advanced tab on the User Accounts Control Panel applet.
You can read more about this feature by entering "hh key.chm" into the Start | Run dialog.
How many times have you been stuck at work because you needed to complete a long-running operation before you could go home? Or maybe you started the operation hoping it would complete overnight, but now you're worrying about it when you should be focused on being home. Or perhaps you've been stuck in your office working on a project that could only be done on your workplace computer?
How many times have you spent hours reproducing a bug on your own system that was readily reproducible on another machine you didn't have physical access to?
The Remote Desktop Connection feature in Windows XP provides a ready solution to these and innumerable other scenarios in which you need to access another computer remotely and securely over a network connection.
Using Remote Desktop, you can run applications on a remote computer running Windows XP Professional from any other client computer running any Windows operating system. The applications run on the Windows XP Professional–based computer and only the keyboard input, mouse input, and display output data are transmitted over the network to the remote location.
Related links
An overview of Windows XP Remote Desktop.
How to set up and use Remote Desktop.
Remote Assistance
Remote assistance is similar to the Remote Desktop Connection in the sense that it allows one computer to view or control another computer remotely. However the Remote Assistance user interface is designed for interactive scenarios where users are logged on and sitting in front of both machines at the same time. (In fact, Remote Desktop Connection does not allow a user to be logged onto a remote machine while it is being controlled remotely.)
Imagine e-mailing a new build to your customer or partner and then phoning them to review installing it and the changes and fixes. Now you can vastly improve on this experience if they ask you for Remote Assistance—you can personally walk your partner through the install, showing them the changes while they sit back and watch you drive their computer remotely. Got Web cameras? Even better—now you can see their faces when you show them your favorite feature.
The links below describe several scenarios that can be used to initiate remote assistance, as well as some details for administering remote assistance on a home or corporate network.
Related links
TechNet Step-by-Step Guide to Remote Assistance.
Using Remote Assistance in Windows XP.
Remote Debugging with Visual Studio .NET
How many times have you had to hike to another building, or even fly somewhere, to debug a problem that you could not reproduce on your own machine? What if you could debug the problem on the remote computer without leaving your own desktop?
If you have the Visual Studio 6.0 remote debugging feature working, then you already know how incredibly your productivity is boosted by source-code debugging your application components running on a server in the next building.
Unfortunately, you might also know how the remote debugging feature was very temperamental, to put it nicely, in Visual Studio 6.0. Not so with Visual Studio .NET; there are still some steps you must take to set it up, but not nearly as many hoops to jump through as before. And even better, after you get it working, it stays working.
Related links
Get the Visual Studio .NET Release Candidate.
Learn more about remote debugging with the Visual Studio .NET "What's New in the Visual Studio Debugger" documentation topic available with the Visual Studio .NET Release Candidate above.
Real-time Communications (RTC)
Windows XP includes a new set of interactive features for communicating with friends and colleagues in real-time using Windows Messenger. These features enable new scenarios for collaborating with your colleagues and partners in the office or the next city directly from your desktop or laptop computer, including text messaging, voice-only and video conferencing, interactively transferring files, sharing applications or drawings, or remotely assisting a friend or colleague by taking over their entire desktop by invitation.
The plumbing for these collaboration features is also available for use by developers in their own applications. Much as reusing the WebBrowser control enables developers to easily add browsing, document viewing, and data downloading capabilities to their applications, the new RTC API in Windows XP allows developers to easily integrate the real-time communication features of Windows XP into their application.
In addition to integrating communications features based on PC-to-PC sessions as seen in Windows Messenger, the RTC client application programming interface (API) enables PC-to-phone and phone-to-phone calls.
Related links
- Integrating Rich Client Communications with the Microsoft Real-Time Communications API.
- Windows Messenger in Windows XP.
- Windows Messenger: New Waves of Innovation.
- Platform SDK: Real-time Communications (RTC) Client API.
- The Platform SDK includes Visual C++® 6.0 and Visual Basic® 6.0 samples demonstrating how to create PC-to-PC, PC-to-phone and phone-to-phone sessions for audio and video; how to do application sharing in PC-to-PC sessions; and how to receive, answer, and disconnect from incoming PC calls. You can download and install the Platform SDK here (make sure you check the box to download the samples), after which you will find the samples in the \Program Files\Microsoft SDK\Samples\NetDS\rtc folder on the installation drive.
- Using RTC as a control on a Windows Form (below).
Developing for Windows XP with Visual Studio .NET
Visual Studio .NET provides a complete set of tools for building Windows XP applications. The tools are based on a new multi-language paradigm in which any programming language can execute under the control of a common language runtime with equal access to the same integrated development environment features and a single, unified class library. Application code that executes on the common language runtime is called managed code.
The class library, provided by the .NET Framework, is a framework of object-oriented, hierarchical, and extensible APIs that unify previously disparate models for application development such as the Microsoft Foundation Classes for C++ and the Windows Foundation Classes for Java, as well as the traditional COM+ and Win32 programming models.
Visual Studio .NET, together with the .NET Framework class library and common language runtime, include functionality for creating Windows applications, Web applications, and Windows Service applications. They also provide functionality for accessing traditional COM interfaces and DLL functions from managed code, and vice versa.
The rest of this article discusses accessing Windows XP functionality from managed code.
Related links
- Visual Studio Developer Center
- .NET Development Developer Center
- .NET Framework SDK Developer Center
- .NET Framework SDK: Introduction to the .NET Framework Class Library
- .NET Framework SDK: .NET Framework Class Library
- .NET Framework SDK: Language Interoperability Overview
Accessing COM Components from Visual Studio .NET
To simplify the development of applications that need to interact with either your own COM+ components or those provided by Microsoft or third parties, the common language runtime offers a set of features that conceal differences between the managed and unmanaged programming models, such as calling conventions and error handling. Visual Studio .NET uses these features to provide the ability to write managed code that accesses functionality implemented by COM DLLs as if the COM interfaces were written in managed code. That's because when you add a reference to a COM type library in Visual Studio .NET, managed wrappers are generated for the COM interfaces described in the type library. Of course, this means there is a bit of a performance penalty accessing COM functionality from managed code.
Related links
- .NET Framework SDK: COM Wrappers
- .NET Framework SDK: Interoperating with Unmanaged Code
- .NET Framework: Adding a Reference to a COM Type Library in Visual Studio .NET
- Building Distributed Applications with .NET
Expose a COM+ Application as an XML Web Service
Using Windows XP and the .NET Framework you can easily expose existing COM+ applications as SOAP endpoints. Thus the methods on a COM interface can be turned into a Web service by clicking a checkbox exposed on the Activation tab in the COM+ Application properties dialog box in the Component Services console.
To learn more, check out this MSDN technical article and sample code: Microsoft .NET and Windows XP COM+ Integration with SOAP.
Use an RTC control on a Windows Form
It is pretty easy to access the RTC capabilities of Windows XP from managed code in Visual Studio .NET by adding a reference to the type library (as discussed above).
However, a bit more work is involved to make RTC as easy to program on a Windows Form at design-time as, say, a textbox, or other control in the Visual Studio .NET Toolbox. So we are providing you with a managed wrapper for RTC for use in Visual Studio .NET Release Candidate in order for you to immediately start playing with integrating RTC into your Windows Forms-based applications.
This initial release of the RTC managed wrapper does not include support for the Presence functionality for determining online availability and location information. We encourage you to play with the RTCSimple form included in the download and to send suggestions and bugs to msdn@microsoft.com with a subject line of "Issues for RTC Managed Wrapper." The sample will be updated with the best of your suggestions and with the presence functionality (after Windows .NET Server Beta 3—required to store the presence information—is released).
Download the Real-time Communications COM Wrapper.
Related links
Using Background Intelligent Transfer Service in Visual Studio .NET
Got a large data file you'd like to download in the background during spare CPU cycles and network bandwidth? Background Intelligent Transfer Service (BITS) is the plumbing that Windows Update uses to transfer files asynchronously to Windows XP desktops, and it is available for any client application needing to get data files from an HTTP server.
BITS continues the download after the initiating application exits, as long as the user remains logged on and maintains a network connection. If the user does log off or interrupts the network connection, BITS will automatically suspend the transfer and resume it the next time the user logs on and establishes a network connection. The transfer state will also persist across machine reboots. BITS exposes a queue manager with the ability to prioritize transfers among four levels of foreground and background priority, and supports polling and callbacks for transfer job status.
The Platform SDK includes a C++ sample showing how to access this functionality. You can download and install the Platform SDK here (make sure you check the box to download the samples), after which you will find the sample in \Program Files\Microsoft SDK\Samples\Web\bits\bits_ie folder on the installation drive.
If you would like to use the BITS interfaces from managed code in Visual Studio .NET, see Using Windows XP Background Intelligent Transfer Service with Visual Studio .NET. This article explains in detail how to use BITS with Visual Studio .NET through a managed wrapper sample code that is included with the MSDN Download.
Posted using illegal copy of BlogJet.
Please purchase a license here.
Posted using illegal copy of BlogJet.
Please purchase a license here.
0 Comments:
Post a Comment
<< Home