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. Wlan connection issue
Qt 6.11 is out! See what's new in the release blog

Wlan connection issue

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.4k Views 2 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 connect to the wireless access point using WlanConnect function.

    Code:

    HANDLE hClient;
    PWLAN_INTERFACE_INFO_LIST pIfList;
    PWLAN_INTERFACE_INFO pIfInfo;
    PWLAN_AVAILABLE_NETWORK_LIST pBssList;
    
    DWORD dwResult = 0;
    WLAN_CONNECTION_PARAMETERS connectionParameters;
    memset(&connectionParameters, 0, sizeof(WLAN_CONNECTION_PARAMETERS));
    connectionParameters.wlanConnectionMode = wlan_connection_mode_profile;
    connectionParameters.strProfile = pBssList->Network[apIndex].strProfileName;
    connectionParameters.dwFlags = 0;
    connectionParameters.pDot11Ssid = NULL;
    connectionParameters.pDesiredBssidList = 0;
    connectionParameters.dot11BssType = dot11_BSS_type_any;
    dwResult = WlanConnect(hClient, &pIfInfo->InterfaceGuid, &connectionParameters, NULL);
    
    if (dwResult == ERROR_SUCCESS) {
        qDebug() << "Connected!";
    } else {
        qDebug() << dwResult;
    }
    

    When connecting to open AP I get 87 error code, it means the wrong parameter. Any ideas what parameter can be wrong? Thanks in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      How is that related to Qt ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Cobra91151C 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        How is that related to Qt ?

        Cobra91151C Offline
        Cobra91151C Offline
        Cobra91151
        wrote on last edited by Cobra91151
        #3

        @SGaist

        The application is built with Qt framework, but since Qt doesn't have Wireless API, I use native Wlan API. So it's related now.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          From a Qt POV, it looks like QNetworkSession and QNetworkConfiguration might be what you are looking for.

          However I have to disagree with your point: you are using a Windows native API. The fact that you are using Qt to build your application doesn't make asking what parameters your should use for the WlanConnect method a Qt related problem. The Microsoft forums might be a better place to learn how to use that method.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Cobra91151C 1 Reply Last reply
          4
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Cobra91151

            As a note. you did see
            https://msdn.microsoft.com/en-us/library/windows/desktop/ms706613(v=vs.85).aspx
            and the list of reason why/when it would return ERROR_INVALID_PARAMETER ?

            Cobra91151C 1 Reply Last reply
            0
            • mrjjM mrjj

              @Cobra91151

              As a note. you did see
              https://msdn.microsoft.com/en-us/library/windows/desktop/ms706613(v=vs.85).aspx
              and the list of reason why/when it would return ERROR_INVALID_PARAMETER ?

              Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by
              #6

              @mrjj

              Thank you. I have check it, the same issue is still exists.

              1 Reply Last reply
              0
              • SGaistS SGaist

                From a Qt POV, it looks like QNetworkSession and QNetworkConfiguration might be what you are looking for.

                However I have to disagree with your point: you are using a Windows native API. The fact that you are using Qt to build your application doesn't make asking what parameters your should use for the WlanConnect method a Qt related problem. The Microsoft forums might be a better place to learn how to use that method.

                Cobra91151C Offline
                Cobra91151C Offline
                Cobra91151
                wrote on last edited by
                #7

                @SGaist

                Ok. I will try your suggestion.

                1 Reply Last reply
                1
                • Cobra91151C Offline
                  Cobra91151C Offline
                  Cobra91151
                  wrote on last edited by Cobra91151
                  #8

                  I have figured it out and fixed the issue. The issue was that the WlanSetProfile function was not set before the WlanConnect function.

                  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