[急]用VB.NET 在win7系统下如何获取本机mac地址

hybcxdn 2014-01-04 03:36:45
用VB.NET 在win7系统下如何获取本机mac地址

XP系统如下代码是OK的,在Win7系统中获取不了。
Dim Wmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")

For Each WmiObj As Management.ManagementObject In Wmi.Get
If CBool(WmiObj("IPEnabled")) Then
Return WmiObj("MACAddress")
End If
Next
...全文
167 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
小魚人 2014-01-06
  • 打赏
  • 举报
回复
本機跟遠端都可以滴
无涯大者 2014-01-06
  • 打赏
  • 举报
回复
应该是权限问题,上述代码可以查到!
threenewbee 2014-01-04
  • 打赏
  • 举报
回复
一样可以,不过你要用管理员身份运行。
wind_cloud2011 2014-01-04
  • 打赏
  • 举报
回复
在win7里测试通过
wind_cloud2011 2014-01-04
  • 打赏
  • 举报
回复
引用System.Management
  
Dim Wmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")
        For Each WmiObj As Management.ManagementObject In Wmi.Get
            If CBool(WmiObj("IPEnabled")) Then
                Dim s As String = WmiObj("MACAddress")
                MessageBox.Show(s)
            End If
        Next
paxCompiler is an embeddable cross-platform compiler of the Object Pascal, Basic and JavaScript programming languages. The key features of the paxCompiler are: The compiler generates machine code for Intel compatible processors (IA-32/64 architecture) for platforms: Win32/Win64, Mac OS, iOS Simulator. The second script runner is a cross-platform interpreter based on intermediate code. Supported platforms are Win32/Win64, Linux, Android, Mac OS, iOS Simulator, iOS Device. The compiler is written in Delphi and it is compatible with Free Pascal/Lazarus 32/64 bit. It is possible to use the compiler as a scripting engine, so you can customize and extend the application without having to recompile it. The compiler supports Object Pascal language based on the Delphi 7 standard and extends it with generic types, operator overloading, anonymous functions and closures, lambda-expressions. Syntax of Basic language is similar to VB.NET. JavaScript implementation is based on ECMA-262 standard. Cross-language programming support. You can use Pascal units in Basic and JavaScript programs and vice versa. COM support. paxCompiler components allow you to implement debugger and code explorer. Script-defined types support run-time information (RTTI). You can bind instances of script-defined classes with dfm files. You can import host-defined types with paxCompiler importer. Automatic import of host-defined types is available for Delphi XE2-XE7. You can create stand alone executable files and dlls. Support of compiled units and run-time packages. paxCompiler engine is thread safe. The nearest milestones on road map of the compiler development include: C/C++ compiler and native code generator for ARM processors.
paxCompiler is an embeddable cross-platform compiler of the Object Pascal, Basic and javascript programming languages. The key features of the paxCompiler are: The compiler generates machine code for Intel compatible processors (IA-32/64 architecture) for platforms: Win32/Win64, Mac OS, iOS Simulator. The second script runner is a cross-platform interpreter based on intermediate code. Supported platforms are Win32/Win64, Linux, Android, Mac OS, iOS Simulator, iOS Device. The compiler is written in Delphi and it is compatible with Free Pascal/Lazarus 32/64 bit. It is possible to use the compiler as a scripting engine, so you can customize and extend the application without having to recompile it. The compiler supports Object Pascal language based on the Delphi 7 standard and extends it with generic types, operator overloading, anonymous functions and closures, lambda-expressions. Syntax of Basic language is similar to VB.NET. javascript implementation is based on ECMA-262 standard. Cross-language programming support. You can use Pascal units in Basic and javascript programs and vice versa. COM support. paxCompiler components allow you to implement debugger and code explorer. Script-defined types support run-time information (RTTI). You can bind instances of script-defined classes with dfm files. You can import host-defined types with paxCompiler importer. Automatic import of host-defined types is available for Delphi XE2-XE7. You can create stand alone executable files and dlls. Support of compiled units and run-time packages. paxCompiler engine is thread safe. The nearest milestones on road map of the compiler development include: C/C++ compiler and native code generator for ARM processors.
paxCompiler is an embedable compiler of the Object Pascal, Basic and JavaScript programming languages. The key features of the paxCompiler are: The compiler generates machine code for Intel compatible processors (IA-32/64 architecture). The second script runner is a cross-platform interpreter based on intermediate code. Supported platforms are Win32/Win64, Linux, Android, Mac OS, iOS Simulator, iOS Device. The compiler is written in Delphi and it is compatible with Free Pascal/Lazarus 32/64 bit. It is possible to use the compiler as a scripting engine, so you can customize and extend the application without having to recompile it. The compiler supports Object Pascal language based on the Delphi 7 standard and extends it with generic types, operator overloading, anonymous functions and closures, lambda-expressions. Syntax of Basic language is similar to VB.NET. JavaScript implementation is based on ECMA-262 standard. Cross-language programming support. You can use Pascal units in Basic and JavaScript programs and vice versa. COM support. paxCompiler components allows you to implement debugger and code explorer. Script-defined types support run-time information (RTTI). You can bind instances of script-defined classes with dfm files. You can import host-defined types with paxCompiler importer. Automatic import of host-defined types is available for Delphi XE2-XE5. You can create stand alone executable files and dlls. Support of compiled units and run-time packages. paxCompiler engine is thread safe. The roadmap of the compiler includes: Java compiler, C++ compiler, built-in assembler.

16,554

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧