• 全部
  • VBS
  • .NET技术
  • VBA
  • VB网络编程
  • VB多媒体
  • VB数据库
  • VB控件
  • VB COM/DCOM
  • VB基础类
  • VB API
  • 问答

WMI的问题,顶也有分.

huohu526 2005-02-22 09:19:54
strClsName = strClsName.Trim()
Dim mc As ManagementClass = New ManagementClass("Win32_UninterruptiblePowerSupply")
Dim moc As ManagementObjectCollection = mc.GetInstances()

Dim strMsg As String = "Nothing"
For Each mo As ManagementObject In moc
...不执行
Next
为什么关于"电源"的类都不能得到其实例
Win32_AssociatedBattery, Win32_Battery, Win32_CurrentProbe, Win32_PortableBattery ,Win32_PowerManagementEvent .等都不能得到其实例.

解决了这个问题,连这个帖子的分也给你. http://community.csdn.net/Expert/topic/3790/3790724.xml?temp=4.140872E-02
...全文
118 点赞 收藏 20
写回复
20 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
yizhixiaozhu 2005-02-23
dd
回复
lyj670 2005-02-23
up
回复
huohu526 2005-02-22
晕, 难道就没有一个会的.
CSDN的高手今天都休息吗.
回复
pinkybs 2005-02-22
up
回复
huohu526 2005-02-22
lyvvvv(lyvvvv) 还不如 yizhixiaozhu(一只小猪) 来的爽快.
回复
blue_11 2005-02-22
狂顶.................
回复
lyvvvv 2005-02-22
以上代码需要添加System.Management的引用
回复
lyvvvv 2005-02-22
这是我用C#写的代码,你可以参考:
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration");
foreach (ManagementObject share in searcher.Get())
{
try
{
string sCaption=share["Caption"].ToString();
MessageBox.Show(sCaption);
}
catch
{
}
}
回复
yizhixiaozhu 2005-02-22
我帮你顶
回复
hamadou 2005-02-22
up!
回复
simon8181 2005-02-22
http://www.microsoft.com/china/technet/community/scriptcenter/default.mspx
回复
心情解码 2005-02-22
:)

--
回复
泡沫游走 2005-02-22
up
回复
huohu526 2005-02-22
说说你的硬件配置,及软件环境.
回复
lyvvvv 2005-02-22
惭愧,写错了一处:Win32_NetworkAdapterConfiguration应该是Win32_UninterruptiblePowerSupply
ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_UninterruptiblePowerSupply");
foreach (ManagementObject share in searcher.Get())
{
try
{
string sCaption=share["Caption"].ToString();
MessageBox.Show(sCaption);
}
catch
{
}
}
回复
lyvvvv 2005-02-22
lyvvvv(lyvvvv) 还不如 yizhixiaozhu(一只小猪) 来的爽快. ???

我的代码你可以试试,我自己就是这样用,只不过是取网卡的MAC地址,以上的代码我也试验过,C#下是可行了。

回复
huohu526 2005-02-22



Power Classes

The Power subcategory groups classes that represent power supplies, batteries, and events related to these devices.

Class Description
Win32_AssociatedBattery Relates a logical device and the battery it is using.
Win32_Battery Represents a battery connected to the computer system.
Win32_CurrentProbe Represents the properties of a current monitoring sensor (ammeter).
Win32_PortableBattery Represents the properties of a portable battery, such as one used for a notebook computer.
Win32_PowerManagementEvent Represents power management events resulting from power state changes.
Win32_UninterruptiblePowerSupply Represents the capabilities and management capacity of an uninterruptible power supply (UPS).
Win32_VoltageProbe Represents the properties of a voltage sensor (electronic voltmeter).
回复
haoztao 2005-02-22
你们再说的啥东东啊。。。,不解!
回复
lang_csdn 2005-02-22

这个是对UPS的管理吧,你的电源上有UPS吗?
>>>>>>>>>>
为什么关于"电源"的类都不能得到其实例
回复
AllenTing 2005-02-22
只有up了
回复
相关推荐
发帖
VB
创建于2007-09-28

1.6w+

社区成员

VB技术相关讨论,主要为经典vb,即VB6.0
申请成为版主
帖子事件
创建了帖子
2005-02-22 09:19
社区公告
暂无公告