WlanQueryInterface数据枚举

时间:2017-03-10 10:06:37

标签: c++ windows-applications wlanapi

我想使用WlanQueryInterface函数获取PDOT11_BSS_TYPE wlanInterfaceState = NULL; DWORD wlanInterfaceStateSize = sizeof(wlanInterfaceState); DWORD interfaceStateResult; interfaceStateResult = WlanQueryInterface(hClient, &pIfInfo->InterfaceGuid, wlan_intf_opcode_bss_type, NULL, &wlanInterfaceStateSize, (PVOID *)&wlanInterfaceState, NULL); if (interfaceStateResult != ERROR_SUCCESS) { qDebug() << "Error"; } else { qDebug() << wlanInterfaceState; }

我的代码:

wlanInterfaceState

我得到十六进制值。当我使用switch来枚举error: C2450: switch expression of type 'PDOT11_BSS_TYPE' is illegal 时,我收到错误:

DOT11_BSS_TYPE

更新 来自MSDN的typedef enum _DOT11_BSS_TYPE { dot11_BSS_type_infrastructure = 1, dot11_BSS_type_independent = 2, dot11_BSS_type_any = 3 } DOT11_BSS_TYPE, *PDOT11_BSS_TYPE; 枚举语法:

wlanInterfaceState

如何在var q = async.priorityQueue(function(task, callback) { // your code process here for each task //when ready to complete the task delay it by calling async.whilst( //wait 6 seconds function() { return count < 10; }, function(callback) { count++; setTimeout(function() { callback(null, count); }, 1000); }, function (err, n) { // n seconds have passed callback(); //callback to q handler } ); //whilst } , 5); 上使用这些枚举? 感谢。

1 个答案:

答案 0 :(得分:0)

问题是我使用指针wlanInterfaceState版本,因此将它与switch一起使用不被认为是正确的表达式。

切换(条件)声明

condition - 任何整数或枚举类型的表达式,或者上下文隐式可转换为整数或枚举类型的类类型的表达式,或者使用大括号或等于初始化程序的此类型的单个非数组变量的声明。

因为它指向枚举,所以我需要取消引用它。

所以switch语句应如下所示:

 switch (*wlanInterfaceState) {
         case dot11_BSS_type_infrastructure:
              qDebug() << "Infastructure";
         break;

         case dot11_BSS_type_independent:
              qDebug() << "Independent";
         break;

         case dot11_BSS_type_any:
              qDebug() << "Any";
         break;

         default:
              qDebug() << "Unknown";
         }