2010-07-21 52 views
1

我试图通过调用API或使用WMI来检测计算机是否连接到域。检测到域的连接

我正在阅读环境。变量USERDOMAIN来检查我是否连接到域,但只适用于我知道的域。 有没有更好的方法来查看我是否连接到LAN /域?

该代码是C,对于Windows XP或7.

谢谢。

回答

1

尝试NetGetJoinInformation。它可以给你四个结果。

 
NetSetupUnknownStatus The status is unknown. 
NetSetupUnjoined  The computer is not joined. 
NetSetupWorkgroupName The computer is joined to a workgroup. 
NetSetupDomainName  The computer is joined to a domain. 

+0

谢谢。你有没有机会看看如何使用它的代码片段? – 2010-07-21 20:34:00

+0

明白了,谢谢... – 2010-07-21 20:42:49