Prev: MSDN((VB6) won't install
Next: DLL Wrapper (I Think?)
From: Bee on 1 Jan 2010 20:42 (1)What is the downside of using WMI? (2)Can I distribute the MS WMICORE or just suggest a user download WMI for Win not having WMI like Win98 etc? I would like to use some WMI calls in my VB6 App. Specifically to get Serial Port information. (3) If not WMI, then what APIs will give me Serial Port info? (4)How do I check for WMI other that error trapping in a wrapper?
From: C. Kevin Provance on 1 Jan 2010 22:05 "Bee" <Bee(a)discussions.microsoft.com> wrote in message news:37F39B6C-F47C-42B5-A79E-4654D2520502(a)microsoft.com... | (1)What is the downside of using WMI? | (2)Can I distribute the MS WMICORE or just suggest a user download WMI for | Win not having WMI like Win98 etc? | I would like to use some WMI calls in my VB6 App. Specifically to get | Serial Port information. | (3) If not WMI, then what APIs will give me Serial Port info? | (4)How do I check for WMI other that error trapping in a wrapper? Have you tried Googling for some of this info? Or do you want someone here to do it for you?
From: MikeD on 1 Jan 2010 22:09 "Bee" <Bee(a)discussions.microsoft.com> wrote in message news:37F39B6C-F47C-42B5-A79E-4654D2520502(a)microsoft.com... > (1)What is the downside of using WMI? > (2)Can I distribute the MS WMICORE or just suggest a user download WMI for > Win not having WMI like Win98 etc? > I would like to use some WMI calls in my VB6 App. Specifically to get > Serial Port information. > (3) If not WMI, then what APIs will give me Serial Port info? > (4)How do I check for WMI other that error trapping in a wrapper? > I'm sure others will come along with better and/or more complete answers, but I'll provide what I know. 1. As best as I know, the major downside to using WMI is that it might not exist or be enabled, which means you can't use it. WMI is a Windows service, and that service can be stopped or disabled. SysAdmins might do this to lock down workstations. 2. I'm not sure about this, but I don't think it's available in any redistributable form. It's a part of the Windows OS. 3. I believe you already got an answer to this in another thread. Or at least a pointer in the right direction. 4. What's wrong with error trapping? Runtime errors are nothing more than information for your app to use. You don't need to user a wrapper. Just *temporarily* change your normal error handling to On Error Resume Next, try to create the object, and then check if your object variable is Nothing. That's by far the easiest way (and this goes for *any* object for which there's a chance you might not be able to create that object). -- Mike
From: mayayana on 1 Jan 2010 23:01 > (1)What is the downside of using WMI? Slow. Clunky. Poorly designed with tedious, non-intuitive SQL syntax required. May not be running/installed. The SQL-like design provides ways to build all sorts of different query variations, which is interesting. But that same flexibility make WMI very difficult to learn. > (2)Can I distribute the MS WMICORE or just suggest a user download WMI for > Win not having WMI like Win98 etc? Yes. It's pre-installed starting with either 2000 or ME. I'm not certain 200 has it, but I know ME does. On NT it runs as a service. On 9x it's set to run at startup. On NT I've also found that it requires DCOM Process Launcher service. So it's the sort of thing that's likely to be up and running on a corporate intranet but really *should* be disabled on a stand-alone system where it's unlikely to be used. Nevertheless, both services run by default, so it should be commonly available. I've used it a fair amount with scripting. It's mainly useful as a scripting tool to supplement the WSH. But I don't find it to be very useful except for getting system info. (I actually disable it when I'm not using it. I figure there's no sense leaving it running when there could be a slight chance of security risk.) The WMI Registry functions are a joke. The WMI software product functions are just a partial, superfluous wrapper around WindowsInstaller, which has a better COM interface available directly. It's mostly used by network admins who want to manage a lot of machines with script. > I would like to use some WMI calls in my VB6 App. Specifically to get > Serial Port information. > (3) If not WMI, then what APIs will give me Serial Port info? I don't know about that, but it must be available. If it were me I'd avoid WMI if at all possible. > (4)How do I check for WMI other that error trapping in a wrapper? > Usually one uses GetObject. Something like: Set WMI = GetObject("WinMgmts:") It's easy enough to test whether that failed. (I think there's also an early-bound interface and some sort of API version of the functions, but I've never used those. As noted above, WMI is mainly something handy to scripters who have a paucity of other tools at their disposal.)
From: C. Kevin Provance on 1 Jan 2010 23:45
"Bee" <Bee(a)discussions.microsoft.com> wrote in message news:37F39B6C-F47C-42B5-A79E-4654D2520502(a)microsoft.com... | (1)What is the downside of using WMI? | (2)Can I distribute the MS WMICORE or just suggest a user download WMI for | Win not having WMI like Win98 etc? | I would like to use some WMI calls in my VB6 App. Specifically to get | Serial Port information. | (3) If not WMI, then what APIs will give me Serial Port info? | (4)How do I check for WMI other that error trapping in a wrapper? | It sucks and I never and would never use it. I can do anything it does with API...one way or the other. |