Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WlanQueryInterface data enumeration
Qt 6.11 is out! See what's new in the release blog

WlanQueryInterface data enumeration

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.8k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by Cobra91151
    #1

    Hi! I want to get wlan_intf_opcode_bss_type using WlanQueryInterface function.

    My code:

    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;
    }
    

    I get hexadecimal values. When I use switch to enumerate on wlanInterfaceState I get error:

    error: C2450: switch expression of type 'PDOT11_BSS_TYPE' is illegal

    DOT11_BSS_TYPE enumeration syntax from 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;
    

    How to use these enumerations on wlanInterfaceState? Thanks.

    mrjjM 1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! This forum is for Qt-specific stuff. For Microsoft's APIs, please see Microsoft's Documentation or your thread on stackoverflow.

      1 Reply Last reply
      2
      • Cobra91151C Cobra91151

        Hi! I want to get wlan_intf_opcode_bss_type using WlanQueryInterface function.

        My code:

        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;
        }
        

        I get hexadecimal values. When I use switch to enumerate on wlanInterfaceState I get error:

        error: C2450: switch expression of type 'PDOT11_BSS_TYPE' is illegal

        DOT11_BSS_TYPE enumeration syntax from 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;
        

        How to use these enumerations on wlanInterfaceState? Thanks.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Cobra91151 said in WlanQueryInterface data enumeration:

        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;

        Hi
        You are using the pointer version for wlanInterfaceState
        So using it in switch is considered illegal as it's not considered correct expression

        attr(optional) switch ( condition ) statement

        condition - any expression of integral or enumeration type, or of a class type contextually implicitly convertible to an integral or enumeration type, or a declaration of a single non-array variable of such type with a brace-or-equals initializer.

        Since it points to enum, then you might need to dereference it

        void MainWindow::on_pushButton_released() {
        
          PDOT11_BSS_TYPE t =  NULL; // nullptr
          switch (*t) { // note the *
          case dot11_BSS_type_infrastructure:
        
              break;
          default:
              break;
          }
        }
        Ps. Need ofc to point to something valid besides NULL. 
        
        Cobra91151C 1 Reply Last reply
        2
        • mrjjM mrjj

          @Cobra91151 said in WlanQueryInterface data enumeration:

          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;

          Hi
          You are using the pointer version for wlanInterfaceState
          So using it in switch is considered illegal as it's not considered correct expression

          attr(optional) switch ( condition ) statement

          condition - any expression of integral or enumeration type, or of a class type contextually implicitly convertible to an integral or enumeration type, or a declaration of a single non-array variable of such type with a brace-or-equals initializer.

          Since it points to enum, then you might need to dereference it

          void MainWindow::on_pushButton_released() {
          
            PDOT11_BSS_TYPE t =  NULL; // nullptr
            switch (*t) { // note the *
            case dot11_BSS_type_infrastructure:
          
                break;
            default:
                break;
            }
          }
          Ps. Need ofc to point to something valid besides NULL. 
          
          Cobra91151C Offline
          Cobra91151C Offline
          Cobra91151
          wrote on last edited by
          #4

          @mrjj

          Now it's working. Thank you very much.

          mrjjM 1 Reply Last reply
          0
          • Cobra91151C Cobra91151

            @mrjj

            Now it's working. Thank you very much.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Cobra91151
            Np. Please mark as Solved :)

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved