If the network recovers before the timeout interval, DCOM reestablishes connections automatically. DCOM makes it easy to implement fault tolerance. One technique is the referral component introduced in the previous section. When clients detect the failure of a component, they reconnect to the same referral component that established the first connection.
The referral component has information about which servers are no longer available and automatically provides the client with a new instance of the component running on another machine. Applications will, of course, still have to deal with error recovery at higher levels consistency, loss of information, etc.
With DCOM's ability to split a component into a server side and a client side, connecting and reconnecting to components, as well as consistency, can be made completely transparent to the client. Microsoft Transaction Server provides a generic mechanism for handling consistency at the application level.
Combining multiple method invocations into atomic transactions guarantees consistency and makes it easier for applications to avoid loss of information. Another technique is commonly referred to as "hot backup. Clients can explicitly connect to both machines simultaneously.
DCOM's "distributed components" make this action completely transparent to the client application by injecting server code on the client-side, which handles the fault-tolerance. Another approach would use a coordinating component running on a separate machine, which issues the client requests to both server components on behalf of the client. A fail-over attempts to "migrate" a server component from one machine to the other when errors occur. This approach is used by the first release of Windows NT Clusters, but it can also be implemented at the application level.
DCOM's "distributed components" make it easier to implement this functionality and shield the clients from the details. DCOM makes implementing sophisticated fault-tolerance techniques easier. Details of the solution can be hidden from clients using DCOM's "distributed components," which run part of the component in the client process.
Developers can enhance their distributed application with fault-tolerance features without changing the client component or even reconfiguring the client machine. The best application is useless, if it can not be easily installed and administered. For distributed applications, it is critical to be able to centralize administration and make client installation as straightforward as possible.
It is also necessary to provide administrators with ways to detect possible failures as soon as possible, preferably before they cause any damage. A common approach to simplifying client side installation can be summarized under the buzzword "thin client": the less functionality that resides on the client, the fewer installation and maintenance problems can occur.
However, the "thinner" the client components, the less user-friendly the overall application, and the higher the demands to both network and server. Also, thin clients do not take advantage of the significant computing power already available on today's desktops, which is not likely to decrease for most users because desktop productivity applications like word processors or spreadsheets are inherently monolithic.
Choosing the right level of "thickness" is thus a critical decision in the design of a distributed application. DCOM helps in making this tradeoff between flexibility and ease of deployment by letting developers and even administrators choose the location of individual components. The same business components for example, data entry validation can be run on the server or on the client with a simple change of configuration. The application can dynamically choose which user interface component to use HTML generator on the server or ActiveX control on the client.
The biggest problem for maintaining "fat" clients is updating those clients to newer versions. As of today, Microsoft Internet Explorer 3. Whenever a user browses to a page, Microsoft Internet Explorer checks the version of the ActiveX controls used on the page and updates them automatically if needed. For Windows , the concept of code download will be extended to the concept of a native COM class store. This class store will use the extended directory to store configuration information about components, including references to the actual code, conceptually extending the local registry as used today.
The class store will effectively provide both Intranet extended directory and Internet code download, Internet search-path code repositories, making them completely transparent to existing applications. Installing and updating the server components is usually a much less critical problem. However, in a highly distributed application, it is often not possible to upgrade all clients simultaneously. DCOM's robust versioning support, described above in the section titled "Evolving Functionality: Versioning," allows servers to expose new functionality while maintaining complete backward compatibility.
A single server component can handle both old and new clients. Once all clients are updated, the component can phase out support for the functionality that is not needed by the new clients. With both code-download and its future extension, the class store, administrators can centrally install and upgrade clients efficiently and robustly, making it possible to migrate from "fat" clients to intelligent clients without thinning out too much functionality.
DCOM's support for robust versioning makes it possible to update servers without previously updating all potential clients. Part of installing and upgrading client components is configuring those components and maintaining their configuration.
As far as DCOM is concerned, the single most important configuration information is the server machine that runs the components needed by a client. With code download and the class store, this configuration information can be managed from a central location. A simple change to the configuration information and installation packages updates all the clients transparently.
Another technique to manage client configuration is through the use of the referral components described above in the section titled "Load Balancing. Simply changing the central referral component changes all clients. Some components, typically server components, require additional component-specific configuration.
These components can use DCOM to expose additional interfaces, which allow changes to the configuration and retrieval of the current configuration.
Using DCOM's security infrastructure, developers can make these interfaces available only to administrators with the appropriate access permissions.
The broad support for rapid development tools makes it easy to write elegant front-end applications that use the administrative interfaces.
The same interfaces can be used for automated configuration changes using simple scripting languages like Visual Basic Script or Java Script. Code download and the class store can be used to centrally configure components.
Referral components are an efficient and elegant way to further centralize configuration information. Components can expose additional DCOM interfaces only visible and accessible to administrators, allowing the same DCOM infrastructure to be used for configuration and monitoring of components. Many distributed applications have to be integrated into a customer's or corporation's existing network infrastructure.
Requiring a specific network protocol would require an upgrade of all potential clients, which is simply unacceptable in most situations. Application developers have to take care in keeping the application as independent as possible of the underlying network infrastructure.
DCOM provides a security framework on all of these protocols, including connectionless and connection-oriented protocols. Developers can simply use the features provided by DCOM and be assured that their application is completely protocol-neutral. A distributed application often has to integrate different platforms on both the client side and the server side. Developers are confronted with significant differences in many aspects of those platforms: Different user interface philosophies, different system services, and even the set of available network protocols make it difficult to target and integrate multiple platforms.
One approach to this problem is to choose the lowest common denominator of all the platforms and use an abstraction layer to maintain a single code base for all platforms. This approach is taken by many conventional cross-platform development frameworks, as well as virtual machine environments like Java.
Its appeal lies in having a single code base or even a single binary for all the supported platforms. However, this simplicity comes at a price. The abstraction layers introduce additional overhead and prevent the use of powerful platform-specific services and optimizations.
For user-interface components, this approach often means poor visual integration with other applications, resulting in greater difficulty of use and increased training costs. For server components, this approach sacrifices the ability to tune the performance of critical components for any platform. DCOM is open to all approaches to cross-platform development. It does not preclude the use of platform-specific services or optimizations, nor does it favor a certain style of system services over others.
DCOM's architecture allows the integration of platform-neutral development frameworks and virtual machine environments Java , as well as high-performance, platform-optimized custom components into a single distributed application.
On one hand, DCOM defines a per-platform binary standard, so customers and developers can mix and match components generated with tools from different vendors and use them with different implementations of the DCOM runtime itself. Even though the details of the DCOM run-time library Object Request Broker may vary from implementation to implementation, the interaction between the run-time library and the components, as well as between components, is standardized.
Unlike other, more abstract object models, with DCOM it is possible to distribute a single binary version of a component for a given platform that works with all other components and run-time libraries. On the other hand, DCOM defines cross-platform services or abstractions for object-oriented distributed computing, including connection to, and creation of, components, locating components, invoking methods on components, and a security framework.
Beyond this, DCOM simply uses the services available on each platform to implement multithreading and concurrency control, user interface, file system interaction, non-DCOM network interaction, and the actual security provider.
DCE RPC defines a proven standard for converting in-memory data structures and parameters into network packets. Its Network Data Representation NDR is platform neutral "reader makes right" and provides a rich set of portable data types. GUIDs provide collision-free, unmanaged naming of objects and interfaces and are the basis of COM's robust versioning.
Windows NT 4. This is very useful for integrating existing DCE RPC-based applications on other platforms, and it provides a smooth migration path for multitier applications that can incrementally take advantage of DCOM features. DCOM for Windows 95 is currently in beta and due for release before the end of A beta version will be available in early Release versions are scheduled for the first half of Microsoft provides the reference implementation of the Java Virtual Machine for the Windows platform.
Java applications can also use most DCOM components by simply importing a Java-compliant description of the component, a description that is automatically generated from a type library. It defines an abstract object model that describes components and their interfaces. It also provides standard mappings from the abstract object definition to concrete programming languages, but it does not define a binary standard in any way. Different ORB implementations that adhere to the standard can achieve, at the most, source level compatibility, but not interchangeability of binary components, one of the reasons that there is not, and probably will not be, a market for off-the-shelf reusable components.
Component providers have to provide source code for their components or compile and test not only for each target platform but also for each target ORB implementation. To take full advantage of a given platform, developers have to sacrifice cross-ORB interoperability and cross-ORB portability. It accommodates the intersection of all inter-ORB protocols. It makes global connectivity a commodity.
The "killer application" that caused the Internet to accumulate critical mass is a simple, standardized page description language HTML , together with a simple document download protocol HTTP. Virtual private networks such as the Windows NT 4.
DCOM-based applications can transparently leverage such a virtual private network. Most companies do not provide direct Internet access to their desktop computers. All but some dedicated server machines are hidden behind a firewall that typically consists of protocol-level port-based and application-level proxy servers filters.
DCOM can work well with both classes of firewalls:. With this range of options, DCOM-based applications can use the Internet for private connectivity within a company, private communication with external customers and partners, and massive public connectivity to any client in the world. In each of these scenarios, DCOM provide flexible security whenever it is needed. For noninteractive, textual, or simple graphical information, HTML pages are a great vehicle that provide a well known and easy way for users to access the information they require.
For more complex, structured, and interactive information, custom components can extend the HTML page to perform the real tasks of the distributed applications in a user-friendly, secure, and efficient manner. Simple business rules can be applied on the client side, providing immediate feedback to the user. More complex business rules can transparently involve server components over DCOM. Existing off-the-shelf components ActiveX controls can be tied to client-side or even server-side custom components using Visual Basic Script or JScript.
Regardless of whether the developer enriches a distributed application with HTML elements or enriches a HTML-based "application" with elements of distributed computing, DCOM provides the necessary component glue to tie the different worlds together. Search this site. Navigation Home. Comparison Algorithms for the N-Queen Problem. Dynamic programming.
Asynchronous Programming Model. Difference between Multithreading and Asynchronous programming. Changing the default web browser. Adobe Flash Catalyst CS5. Android Development Tutorial - Froyo. WMIC Snippets. Access restriction: Class is not accessible due to restriction on required library. Install Eclipse Plugins. XSLT and Eclipse. How can I modify Emacs to act more like a Windows app. Predictive abbreviation. Visual Studio Ttricks-in-emacs. Enterprise Architect.
Compare Gostai Studio versions. Compare Gostai Lab versions. How to install and run KDE programs in Windows. Change Theme. Software to build word cloud. Text editor with autocomplete while typing normal text. Git Tutorial. SVN cheat sheet. SVN Tutorial for Linux. Product Comparison. Create a Basic Code Snippet. How to: Create a New Snippet with Replacements. Error when you open Visual Studio sln in Visual Studio Installation on Windows 7.
Keyboard Shortcuts. Changing the Runtime Library to Multi-Threaded. Visual Studio Professional vs. Standard edition. Differences of VS to VS regarding include directories. Random Number. Where is ASP. NET 3. Hands On ASP. Other XML Technologies. Hilo User Experience. How to determine default libraries for an. Javascript and SWFObject to stop leeching flash videos. Setup using Adobe Flex Builder. Why Haskell is beyond ready for Prime Time. Is Threaded Java is Too Difficult?
Packaging and Deploying Desktop Java Applications. Realistically real-time. Reflective programming. Text to Speech. Create standalone executable for matlab. Digital Image Processing in Matlab Toolbox. For an end user to run an application or use a library that contains compiled M-code. Matlab FAQ. Where is the file MCRInstaller. Bugging Out. Calling All Operators. Databases and Other Animals.
Down the Rabbit Hole. Functionally Yours. Going to the Polls. Looping The Loop. No News is Good News. Rank and File. Sinfully Simple. SQLite My Fire! The Bear Necessities. The Food Factor. The Trashman Cometh. How to Configure Eclipse for Python.
Fastest way to query an XML document. Understanding XML Namespaces. Understanding XML Schema. XML Tools. Understanding User and Kernel Mode.
Multimedia Programming. Open Source. Configure IIS 5. Description of the Microsoft Windows registry. Environment Variables in Windows XP. An exception occurred while trying to run sapi.
Microsoft Agent technologies. Reference for Armadillo 0. Install boost to the VS Capture video from webcam with ffmpeg on linux. Capture video from webcam with ffmpeg on Windows. Browser vs application. Native Process connection capabilities in AIR 2. What is the relationship between AIR and Ajax? Building the user interface.
Creating a justified multiline Spark Button control in Flex 4. Flex development tools. Image Gallery. Play YouTube video in mxml player. XML processing. XMLListCollection objects. Hardware specs-phones. Google Chart API.
Under the covers, the thing that we see as the Backdrop. When we set the variable equal to that object, it is just given the memory location of that data structure.
The Windows operating system works in a very similar way, but at a much more granular level; almost everything within Windows is maintained as a small data structure somewhere.
If we want to work with the item that is represented by that structure such as a window , we need to get a reference to it and pass that reference to the appropriate API function.
These references are known as handles and are just ID numbers that Windows uses to identify the data structure. Variables used to store handles are usually given the prefix h and are declared As Long. In these cases, we can just discard the handle when we're finished with it. In most situations, however, Windows allocates an area of memory, creates a new data structure for us to use and returns the handle to that structure. In these cases, we must tidy up after ourselves, by explicitly telling Windows that we've finished using the handle and by implication, the memory used to store the data structure that the handle points to.
The most common cause of memory leaks is forgetting to include tidy-up code within a routine's error handler. The MSDN documentation will tell you whether you need to release the handle and which function to call to do it.
In general practice, however, it is a very good idea to wrap your API calls inside their own VBA functions and to place those functions in modules dedicated to specific areas of the Windows API, for the following reasons:.
Passing invalid data to API functions will often result in a crash. Most of the textual API functions require string variables to be defined and passed in, which are then populated by the API function. Using a VBA routine hides that complexity.
Many API functions accept parameters that we don't need to use. A VBA routine can expose only the parameters that are applicable to our application. Few API functions can be used in isolation; most require extra preparatory and clean up calls.
The API declarations themselves can be declared Private to the module in which they're contained, so they can be hidden from use by other developers who may not understand how to use them; their functionality can then be exposed through more friendly VBA routines. Some API functions, such as the encryption or Internet functions, require an initial set of preparatory calls to open resources, a number of routines that use those resources and a final set of routines to close the resources and tidy up.
By using dedicated modules for specific areas of the Windows API, we can easily copy the routines between applications, in the knowledge that they are self-contained.
When you start to include lots of API calls in your application, it quickly becomes difficult to keep track of which constants belong to which functions.
We can make the constants much easier to manage if we encapsulate them in an enumeration and use that enumeration for our VBA function's parameter, as shown in Listing By doing this, the applicable constants are shown in the Intellisense list when the VBA function is used, as shown in Figure The ability to define enumerations was added in Excel I would like to receive exclusive offers and hear about products from InformIT and its family of brands.
I can unsubscribe at any time. Pearson Education, Inc. This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.
To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:.
For inquiries and questions, we collect the inquiry or question, together with name, contact details email address, phone number and mailing address and any other additional information voluntarily submitted to us through a Contact Us form or an email.
We use this information to address the inquiry and respond to the question. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes. Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites.
Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.
Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.
If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information informit. On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. A GUID rhymes with "fluid", stands for g lobally u nique id entifier is a bit number. Each interface and coclass has a GUID. You will also see the term UUID which stands for u niversally u nique id entifier at times.
It is not a "handle" to anything, despite the H prefix. Every language has its own way of dealing with objects. Now, in between those two stages of creating and destroying the object, you actually have to use it.
If the object is created successfully, the COM library returns a pointer to the requested interface. The prototype for CoCreateInstance is:.
When you call CoCreateInstance , it handles looking up the CLSID in the registry, reading the location of the server, loading the server into memory, and creating an instance of the coclass you requested. As stated before, you don't free COM objects, you just tell them that you're done using them.
You call this method to tell the COM object that you no longer need it. Once you call Release , you must not use the interface pointer any more, since the COM object may disappear from memory at any time. If your app uses a lot of different COM objects, it's vitally important to call Release whenever you're done using an interface. If you don't release interfaces, the COM objects and the DLLs that contain the code will remain in memory, and will needlessly add to your app's working set.
The name is a bit misleading, in that it's not an unknown interface. We've already seen Release in action, but what about QueryInterface? If the COM object implements more than one interface not counting IUnknown , you use QueryInterface to get any additional interface pointers that you need.
The prototype of QueryInterface is:. Let's continue our shell link example. If it succeeded, you can then use the new interface pointer, pIPF , just like any other interface. I need to make a detour for a few moments, and discuss how to handle strings in COM code. If you are familiar with how Unicode and ANSI strings work, and know how to convert between the two, then you can skip this section.
Otherwise, read on. Whenever a COM method returns a string, that string will be in Unicode. Well, all methods that are written to the COM spec, that is!
You should definitely read up on the TCHAR types, though, to be aware of them in case you ever come across them in code written by others. When you get a Unicode string back from a COM method, you can convert it to a char string in one of several ways:. This API's prototype is:. Whew, a lot of boring details! Like always, the docs make it seem much more complicated than it really is.
0コメント