COMments

[Previous] [Next]

Notice that there is no Visual Basic project in the sample containing the SecurityGuard class that stubs out the properties and methods—my intention was to create just a type library containing COM interfaces. In Visual Basic ActiveX component projects, you can generate type libraries in addition to component binaries by checking the Remote Server Files option on the Component tab of the Project Properties dialog box. There is no option to generate type libraries only, however. I decided to define the interfaces using the Microsoft Interface Definition Language (IDL) and compile the interfaces into a type library.

Throughout this chapter, I've mentioned the local/remote transparency feature of the COM technology that is an inherent part of Visual Basic. I've explained that when a client requests a reference to an interface of an object that doesn't reside within the client process's address space, COM will interpose and create a proxy in the client's address space that services requests across process boundaries to and from the real object. While this is true, you should be aware that COM proxies might also be created within the client process's address space when the client is a multithreaded application and the type of thread safety defined by the client is incompatible with the objects created in that client's address space. The end result might well be a proxy created by COM in one thread that services requests to the real object in another thread. (See Chapter 3 for more on this topic.) Proxies always perform less efficiently than direct references; there is a noticeable lag even within the same address space, so smart proxies are also appropriate for this multithreaded scenario. Version 6 of Visual Basic does not provide support for creating multithreaded clients, hence the reason that scenario was not previously mentioned. As discussed in Chapter 3—although generally it is inadvisable—you can roll your own multithreaded client application.



Microsoft Visual Basic Design Patterns
Microsoft Visual Basic Design Patterns (Microsoft Professional Series)
ISBN: B00006L567
EAN: N/A
Year: 2000
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net