INFO: Tips to Improve Performance While Using OLE ServersLast reviewed: February 26, 1997Article ID: Q138072 |
4.00
WINDOWS
kbole
The information in this article applies to:
SUMMARYThis article lists tips to keep in mind when instantiating an OLE server object, when calling a method, or when using a property of the object.
MORE INFORMATION
Tip OneHere are two ways in which an object could be created using early binding:
In the former code, each call to a member of an object checks to see if it has been instantiated. If not it is instantiated at that point, the call is made. In the latter code, no such check is made, so it is faster. It is the responsibility of the application developer to ensure that an object variable has been properly instantiated before calling any of its members. Another thing to keep in mind is that the former code guarantees that you always have a reference to an object. Therefore, even if you:
Set x = Nothingand later check:
If x Is Nothing Thenx is instantiated at that point. Such a check will always return a value of False. Whereas in the latter code, you are always free to set x to Nothing and check for it correctly later.
Tip TwoWhile calling members of an out-of-process OLE Server such as an OLE EXE server, if you need to make repetitive calls to members that return quickly (for example, members like the height property of the Form object that don't use many instruction cycles), it will be faster to call a single method that bundles all these other "lightweight" properties into an array or returns them as parameters to this single method. This is because the time taken by the marshalling code for a cross-process call to execute is much more than what is needed to perform the task that the member does.
|
KBCategory: kbole
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |