Jul 2, 2007 at 11:38 AM
It would be nice to provide us with an example of how to use your work. It is a very neat class, but Memory Pointers are required for almost everything and that's not really standard stuff.
So forgive me for my stupidity, but here's what I tried out (to scan the available network list) which seems to fail miserably...

PS: Although this piece of code is written in vb.net, c# is just as good for me :)

Dim x As New NativeWifi.WlanClient
Dim y As NativeWifi.WlanClient.WlanInterface = x.Interfaces(1)
Dim clH As New IntPtr

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim uintNeg As UInt32

Wlan.WlanOpenHandle(Wlan.WLANCLIENTVERSION_LONGHORN, Nothing, uintNeg, clH)

Dim list As New IntPtr
NativeWifi.Wlan.WlanGetAvailableNetworkList(clH, y.InterfaceGuid, NativeWifi.Wlan.WlanAvailableNetworkFlags.IncludeAllAdhocProfiles Or NativeWifi.Wlan.WlanAvailableNetworkFlags.IncludeAllManualHiddenProfiles, Nothing, list)

'Dim strL As Point

Dim b() As Byte = CType(Runtime.InteropServices.Marshal.PtrToStructure(CType(Runtime.InteropServices.Marshal.PtrToStructure(list, GetType(Wlan.WlanConnectionParameters)), Wlan.WlanConnectionParameters).dot11SsidPtr, GetType(Wlan.Dot11Ssid)), Wlan.Dot11Ssid).SSID
For inti As Integer = 0 To b.Length - 1
Debug.WriteLine(" ")


End Sub
Jul 6, 2007 at 4:38 PM

It would be nice to provide us with an example of how to use your work.

You're right. Seeing how you used it, an example would've been useful here.

It is a very neat class, but Memory Pointers are required for almost everything and that's not really standard stuff.

You should have used the WlanClient class. The Wlan class exposes the native functions, but they're more useful to me (internally, for my WlanClient implementation) than to you. Better stick to using WlanClient.
Jul 17, 2007 at 3:00 PM
So is it not possible to get a list of available networks using the WlanClient class? The closest I could get to a list of networks is the following:

Dim x As New NativeWifi.WlanClient
Dim y As WlanInterface = x.Interfaces(0)
For Each p As WlanProfileInfo In y.GetProfiles

But that only appears to show the networks I've already connected to or have stored profiles for.

How can I scan for available networks?

Thank you for your time.
Jul 17, 2007 at 4:42 PM
Hi Gary,

Yes, that's true - GetProfiles is not the right way to go. You should use WlanClient's Scan method. The clumsy thing about Scan is that it's asynchronous: it returns immediately, and then you should get an event (you can subscribe to one of WlanClient's events, not sure which...) and only once you get the ScanComplete notification code, only then you can call WlanGetAvailableNetworkList...

- but guess what, I didn't include this method yet. So maybe it isn't ready for version 1.0 yet ...

I'll try to cover this basic feature (scanning) ASAP.
Jul 17, 2007 at 4:43 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 31, 2007 at 7:36 AM
Hi, for those of you who were looking for SSID list through this native wifi class, here is my example (c#):

using System;
using System.Collections.Generic;
using System.Text;
using NativeWifi;

namespace ConsoleApplication1
class Program
static void Main(string[] args)
WlanClient WC = new WlanClient();

//We must define the flags for using the "GetAvailableNetworkList" function.
Wlan.WlanGetAvailableNetworkFlags flag = new Wlan.WlanGetAvailableNetworkFlags();

//refreshing the network list.

//The array that contains the networks details.
Wlan.WlanAvailableNetwork[] WList;

WList = WC.Interfaces0.GetAvailableNetworkList(flag);
foreach (Wlan.WlanAvailableNetwork ssid in WList)
Console.WriteLine("SSID is : " + Encoding.ASCII.GetString(ssid.dot11Ssid.SSID));

Jul 22, 2008 at 6:55 AM

how to retrieve the SSIDs and RSSIs from available network using Wlan.WlanBssEntry.rssi?
I can do this using Wlan.WlanAvailableNetwork but the RSSIs are different compared to what I get using wifi scanner like wifisistr or net stumbler

thanks for any help