Connect to WiFi

djuro 21 Reputation points
2022-02-13T19:15:02.52+00:00

I work mostly with microcontrollers, but sometimes I have a need to make a Windows based application that will either test some code that will later be ported to a microcontroller, or to test some communication issue. The level of Windows programming I do explains why I still do all my code in C/C++ and MFC.
I now have a need to programmatically connect to WiFi from a Windows application (to a microcontroller which is in AP mode). Some old documents I found online suggest that Native WiFi APIs can be used for this purpose and I found some examples as well (https://github.com/microsoft/Windows-classic-samples/blob/main/Samples/Win7Samples/netds/wlan/autoconfig/wlsample.cpp). Including wlanapi.h is not a problem, but linking to wlanapi.lib gives me a tons of linker errors.
What I do is – I edit solution properties / linker / general / additional library directories and add C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\um\x64 as this is the only folder where I found wlanapi.lib. However, like I said, I get all kind of linking errors.
Can you please be so kind to tell me what is the best way to programmatically connect to WiFi with the “old” technology that I use.
Thank you.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,428 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,275 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 15,061 Reputation points Microsoft Vendor
    2022-02-14T02:29:21.347+00:00

    Hello,
    Welcome to Microsoft Q&A!

    I see the file shows that the last modification time is 2006. I cannot run it directly in VS2019, so we need to modify the project properties.

    Project -> Properties -> Platform Toolset (choose Visual Studio 2012 (v110) )

    Under normal circumstances, there is no V110 option in VS2019, you need to download VS2012, after the download and installation is complete, V110 will appear in VS2019.

    173913-usev110.png
    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful