Alex Angelopoulos (aka at mvps dot org)
One of the most amazing things about VB from the start of its Golden Age (meaning VB5 to scripters) is that usable ActiveX controls which can do almost anything can almost write themselves. Almost.
The dual "almost" is to an easily overcome limitation (lack of direct API access) and a not-so-easily-overcome advantage (anyone can code it) of the language.
The limitation is the fact that API calls cannot be done without care in VB; the data types used by the API and often the very manner in which the API is called bears little resemblance to VB's native structures. This makes calling some of the APIs an advanced art; fortunately, VB provides the tools to do this even though it may take some serious learning on the part of someone trying to make the calls.
The "advantage" is that VB is a language almost anyone can learn to use in minutes. The dirty underside of this is that people who have only a few minutes of real learning are often coding and proudly reproducing their efforts (within 15 minutes of writing my first ActiveX control, I had it posted on a website - ugh). This can make getting reliable, trustworthy controls to do something a significant effort for people new to coding.
Once choice is to write your own API wrappers, knowing that you will need to struggle to get them right, and that an overlooked constant or weak type conversion can come back and bite you months down the road. Another choice can be to take code other people have written, often poorly-suited to your needs, and try to use it for your own components. Development time may be significantly reduced, but you get a "Cracker Jacks" approach to the black-box components thus derived. You open it up, start eating, and sooner or later hit a surprise.
I fortunately ran across some interesting websites early in my dealing with API wrappers which solved this problem for me, and due to the particular copyrights used by the authors, it can also solve the problem for you.
A few of the experienced VB coders out there who have been writing VB since early in the Windows 3 days or before actually post their code on the Internet. The source code is usually well-written, with useful components decoupled from each other and from user I/O, and the API wrappers are done by people who not only know what they are doing from past experience, but have usually gone through several years of continuous public use and debugging. It doesn't get much better than that.
Even better, the coders of whom I speak usually have very sensible code copyrights, which don't allow you to share the source code but do allow you to reuse and redistribute the compiled output. As a result, I can compile a class into an ActiveX control, bundle it with some basic documentation and example scripts, and post it for your use.
Most of the components below come from a small group of original authors. I am breaking down my listings by author since it also enables you to go look up the original code, and allows me to give some much-deserved credit where credit is due.
Unless otherwise stated, all of the DLLs below were written in VB6; consequently, your system needs the VB6 runtimes installed to use them. Most systems deployed today have them (including Windows XP and .NET server). If yours does not, you can find a link to the download in the following MSKB article:
Q192461 - FILE: VBRun60.exe Installs Visual Basic 6.0 Run-Time Files
Pretty much everything here is a compiled DLL built from classes available on Karl's One-Stop Source Shop Samples page - which is where you can also get the original source code.
An ActiveX DLL compile of Karl's COpSysInfo class.
A URL crack/combine class.
Built from Karl's PrnInfo application. Extended by switching enumerations to public and adding many Win2k+ specific enumeration elements.
A simple ping COM control I compiled from Randy's write-up on How to Ping an IP Address By Host Name.
LJ is another VB coder who has been coding for years on end.
LJ put together an ActiveX DLL with his code for this already, so I'm simply providing a link to the page with this control; there are quite a few other interesting tools there too.
LJ wrote a VB-based Server Manager clone. I've abstracted the classes and recompiled as a DLL for use from script.
Microsoft doesn't always post the world's nicest VB code, for various reasons (some of which don't need to be gone into). It can be a good starting point for wrapping obscure APIs, though. If you are having problems finding information about an interface, besides doing everything from scratch yourself with the Platform SDK, you can also check support.microsoft.com. I usually go to Google, plug in the support site and "Visual Basic", and then the name of the API.
Based on Q218965 - HOWTO: Obtain the Owner of a File on Windows NT