日期:2014-05-18 浏览次数:21430 次
public static uint GetSignalQuality(Guid gg)
{
    UInt32 dwSize = 0;
    IntPtr ppData = IntPtr.Zero;
    IntPtr ppChannel = IntPtr.Zero;
    WLAN_OPCODE_VALUE_TYPE pOpcodeValueType;
    if (WlanQueryInterface(m_pClientHandle, ref gg, 
        WLAN_INTF_OPCODE.wlan_intf_opcode_current_connection, 
        IntPtr.Zero, out dwSize, out ppData, 
        out pOpcodeValueType) != ERROR_SUCCESS)
    {
        m_errorMessage = "Failed WlanQueryInterface() - " + 
                         "Current  Connection Attributes";
        return 0;
    }
    if (ppData != IntPtr.Zero)
    {
        WLAN_CONNECTION_ATTRIBUTES connectionAttributes = 
             new WLAN_CONNECTION_ATTRIBUTES(ppData);
        return connectionAttributes.wlanAssociationAttributes.wlanSignalQuality;
    }
    return 0;
}
------解决方案--------------------