互操作与对象管理 [英] Interop Vs Object Managment

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

问题描述

什么是获取硬件信息,互操作或对象管理的更好方法?

What is better for getting hardware information, Interop or Object management?

推荐答案

没有其他选择.不清楚对象管理"是什么意思.

问题很简单:.NET库可以提供对硬件信息的某些访问,但是只有通过本机OS才能访问更多信息.本质上,几乎所有内容都可以通过Interop(P/Invoke)进行访问,其中只有一部分与.NET Framework捆绑在一起并放在GAC(全局程序集缓存)中,有些则需要您自己完成.

参见:
http://en.wikipedia.org/wiki/P/Invoke [ http://msdn.microsoft.com/en-us/library/aa288468%28v = vs.71%29.aspx [ ^ ].

您需要了解的另一件事是WMI和硬件清单:
http://en.wikipedia.org/wiki/Windows_Management_Instrumentation [ http://msdn.microsoft.com/en-us/library/system.management.aspx [ ^ ],
http://technet.microsoft.com/en-us/library/cc180952.aspx [ ^ ].

另请参见此CodeProject文章: WMI硬件/软件枚举脚本 [
There are no such alternatives. Not clear what do you mean by "Object management".

The problem is simple: some access to hardware information can be provided by .NET libraries, but a lot more is only accessible through a the native OS. Essentially, nearly everything is accessible via Interop (P/Invoke), only a part of it is bundled with .NET Framework and placed in GAC (Global Assembly Cache) and some you have to do by yourself.

See:
http://en.wikipedia.org/wiki/P/Invoke[^],
http://msdn.microsoft.com/en-us/library/aa288468%28v=vs.71%29.aspx[^].

Another thing you need to know is WMI and Hardware Inventory:
http://en.wikipedia.org/wiki/Windows_Management_Instrumentation[^],
http://msdn.microsoft.com/en-us/library/system.management.aspx[^],
http://technet.microsoft.com/en-us/library/cc180952.aspx[^].

See also this CodeProject article: WMI Hardware/Software Enumeration Script[^].

The rest of it depends on what hardware are you interested in and what kind of information do you need.

—SA


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

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