Understanding Objects - More about objects
(Page 4 of 4 )
COM objects come in many styles depending upon their intended use. They allow you to control nearly every aspect of the computing experience from controlling operating system behavior to automating individual programs. These objects can add a lot of power to your script or program without you needing to write the code for yourself.
In the case of scripting, they can provide functionality that you simply couldn’t write due to the limitations of the language and the environment.
Some types of COM objects include OLE, OLE Automation, ActiveX, COM+ and DCOM. Each of these is built on a different technology to provide a different type of functionality.
If you would like to explore the different COM objects available on your system, you should download a COM object viewer. Many programming environments such as Visual Studio provide one for you. Other third party solutions are also available.
Most of the time, these will let you view the publicly available methods and properties that are exposed by these objects. The documentation will typically be archaic, but a little trial and error can prove useful. Just understand that many of the objects you find will not be scriptable, so most of them will not work in WSH.
You can find a plethora of information concerning COM objects with a good Google search or by stopping by Microsoft’s MSDN site.
Any time that you are forced to reuse several related methods or properties, you may wish to consider creating a COM object—especially if you intend to distribute them for use in other scripts or programs.
Even if you don’t know or have the ability to program in any compiled languages, there is a way to create your own custom COM objects in WSH. We’ll tackle that topic in a future article. Until then, keep coding!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |