1. #include <windows.h>
2. #include <Wlanapi.h>
3. #pragma comment(lib,"Wlanapi.lib")
4. int _tmain(int argc, _TCHAR* argv[])
5. {
6.
HANDLE hClient;
7. DWORD dwVersion;
8. WLAN_INTERFACE_INFO_LIST *pInterfaces = NULL;
9. WLAN_BSS_LIST *bssList;
10. switch (WlanOpenHandle(1,NULL, &dwVersion, &hClient))
11. {
12. case ERROR_SUCCESS:
13. if(WlanEnumInterfaces(hClient, NULL,&pInterfaces)==ERROR_SUCCESS)
14. {
15. for(DWORD i=0;i<pInterfaces->dwNumberOfItems;i++)
16. {
17. wprintf(L"Interface -- %s\n", pInterfaces[i].InterfaceInfo->strInterfaceDescription );
18. if(WlanGetNetworkBssList(hClient,&pInterfaces[i].InterfaceInfo->InterfaceGuid ,NULL,dot11_BSS_type_any,FALSE,NULL,&bssList)==ERROR_SUCCESS)
19. {
20. for(DWORD j=0;j<bssList->dwNumberOfItems;j++)
21. {
22. wprintf(L"\t%S\n",bssList->wlanBssEntries[j].dot11Ssid.ucSSID);
23. }
24. WlanFreeMemory(bssList);
25. }
26.
27. }
28. WlanFreeMemory(pInterfaces);
29. }
30. WlanCloseHandle(hClient,NULL);
31. break;
32. case ERROR_NOT_ENOUGH_MEMORY:
33. wprintf(L"No hay suficiente memoria\n");
34. break;
35. case ERROR_OLD_WIN_VERSION:
36. wprintf(L"Version incompatible\n");
37. break;
38. }
39. return 0;
40. }
41.