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
Forum Updated to NodeBB v4.3 + New Features

Wlan connection issue

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.1k 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.
  • C Offline
    C Offline
    Cobra91151
    wrote on 14 Aug 2017, 20:14 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
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 14 Aug 2017, 21:19 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

      C 1 Reply Last reply 14 Aug 2017, 21:23
      1
      • S SGaist
        14 Aug 2017, 21:19

        Hi,

        How is that related to Qt ?

        C Offline
        C Offline
        Cobra91151
        wrote on 14 Aug 2017, 21:23 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
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Aug 2017, 20:40 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

          C 1 Reply Last reply 16 Aug 2017, 08:01
          4
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 15 Aug 2017, 22:14 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 ?

            C 1 Reply Last reply 16 Aug 2017, 08:00
            0
            • M mrjj
              15 Aug 2017, 22:14

              @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 ?

              C Offline
              C Offline
              Cobra91151
              wrote on 16 Aug 2017, 08:00 last edited by
              #6

              @mrjj

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

              1 Reply Last reply
              0
              • S SGaist
                15 Aug 2017, 20:40

                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.

                C Offline
                C Offline
                Cobra91151
                wrote on 16 Aug 2017, 08:01 last edited by
                #7

                @SGaist

                Ok. I will try your suggestion.

                1 Reply Last reply
                1
                • C Offline
                  C Offline
                  Cobra91151
                  wrote on 16 Aug 2017, 13:26 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

                  3/8

                  14 Aug 2017, 21:23

                  5 unread
                  • Login

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