WMI 与 Windows API [英] WMI vs Windows APIs

查看:36
本文介绍了WMI 与 Windows API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 WMI 有任何优点或缺点 而不是 Windows API访问系统信息?速度、额外权限、内存使用.

There are any advantages or disadvantages of using the WMI instead of Windows API to access to the information of the system? as speed, additional permissions, memory usage.

还是取决于 WMI 类以及 WMI 如何实现对信息的访问?

or depends on the WMI class and how the WMI implements the access to the information?

推荐答案

WMI 的主要缺点是速度,查询数据很慢,如果您在启动期间尝试使用它,它会延迟您作为 WMI 启动服务需要很长时间.

The main disadvantage of WMI is speed, it is slow to query data and if you are trying to use it during start up it can delay you starting as the WMI service takes a long time to come up.

然而,WMI 信息更丰富,因为有时您需要进行多次 API 调用才能获得相同的数量,有些信息更容易获得,并且过滤语法可以大大减少您必须编写的代码量.

However, WMI information is richer, as in you need to sometimes make several API calls to get the same amount, some information is a lot easier to get at and the filtering syntax can dramatically reduce the amount code you have to write.

如果速度不是一个大问题,我总是倾向于 WMI.

If speed isn't a massive issue, I would always lean towards WMI.

这篇关于WMI 与 Windows API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆