请教下为何MSDN里查不到GetAdaptersInfo这个API,
介绍函数的地方说WindowSDK里提供了GetAdaptersInfo这样一个函数可以获取到网卡MIC地址.因为一直也没下WindowsSDK,一直都还以为MSDN里能...
介绍函数的地方说Window SDK里提供了GetAdaptersInfo这样一个函数可以获取到网卡MIC地址.
因为一直也没下WindowsSDK,一直都还以为MSDN里能查到所有MS给的API函数,结果今天发现原来不是这样.
那如果我下载Windows SDk并使用里面的函数,是不是还要引用其他非系统自带的模块?
可是windows自带的模块里连一个获取MIC地址的函数都没有吗?
如果是这样,那W SDK里是不是还有很多这种有用的函数而我用不了呢,比如呢?
还有一问 比如在MSDN里查GetWindowText时,除了MFC里定义的还有一条是出自"Windows User Interface : Platform SDK",
那这个"Platform SDK"和"Windows SDK"又有什么区别了?我以为是一个东西来着.. 展开
因为一直也没下WindowsSDK,一直都还以为MSDN里能查到所有MS给的API函数,结果今天发现原来不是这样.
那如果我下载Windows SDk并使用里面的函数,是不是还要引用其他非系统自带的模块?
可是windows自带的模块里连一个获取MIC地址的函数都没有吗?
如果是这样,那W SDK里是不是还有很多这种有用的函数而我用不了呢,比如呢?
还有一问 比如在MSDN里查GetWindowText时,除了MFC里定义的还有一条是出自"Windows User Interface : Platform SDK",
那这个"Platform SDK"和"Windows SDK"又有什么区别了?我以为是一个东西来着.. 展开
2个回答
展开全部
MIC地址?还是MAC地址?
MAC地址可以用下面的方法获得:
1,用注册表
HKLM\Software\Micrososft\Windows NT\CurrentVersion\NetworkCards
2 使用WMI
Windows Management Instrumentation
用下面的语句查询WMI即可。
SELECT IPAddress, IPSubnet,MACAddress
from Win32_NetworkAdapterConfiguration
具体代码自己查吧,印象会深刻一点。
MAC地址可以用下面的方法获得:
1,用注册表
HKLM\Software\Micrososft\Windows NT\CurrentVersion\NetworkCards
2 使用WMI
Windows Management Instrumentation
用下面的语句查询WMI即可。
SELECT IPAddress, IPSubnet,MACAddress
from Win32_NetworkAdapterConfiguration
具体代码自己查吧,印象会深刻一点。
展开全部
GetAdaptersInfo
The GetAdaptersInfo function retrieves adapter information for the local computer.
DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
Parameters
pAdapterInfo
[out] Pointer to a buffer that, , receives a linked list of IP_ADAPTER_INFO structures.
pOutBufLen
[in] Pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.
Return Values
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the following error codes.
Value Meaning
ERROR_BUFFER_OVERFLOW The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size.
ERROR_INVALID_PARAMETER The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter.
ERROR_NO_DATA No adapter information exists for the local computer.
ERROR_NOT_SUPPORTED GetAdaptersInfo is not supported by the operating system running on the local computer.
Other If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
See Also
IP_ADAPTER_INFO
The GetAdaptersInfo function retrieves adapter information for the local computer.
DWORD GetAdaptersInfo(
PIP_ADAPTER_INFO pAdapterInfo, // buffer to receive data
PULONG pOutBufLen // size of data returned
);
Parameters
pAdapterInfo
[out] Pointer to a buffer that, , receives a linked list of IP_ADAPTER_INFO structures.
pOutBufLen
[in] Pointer to a ULONG variable that specifies the size of the buffer pointed to by the pAdapterInfo parameter. If this size is insufficient to hold the adapter information, GetAdaptersInfo fills in this variable with the required size, and returns an error code of ERROR_BUFFER_OVERFLOW.
Return Values
If the function succeeds, the return value is ERROR_SUCCESS.
If the function fails, the return value is one of the following error codes.
Value Meaning
ERROR_BUFFER_OVERFLOW The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size.
ERROR_INVALID_PARAMETER The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter.
ERROR_NO_DATA No adapter information exists for the local computer.
ERROR_NOT_SUPPORTED GetAdaptersInfo is not supported by the operating system running on the local computer.
Other If the function fails, use FormatMessage to obtain the message string for the returned error.
Requirements
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in Iphlpapi.h.
Library: Use Iphlpapi.lib.
See Also
IP_ADAPTER_INFO
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询