471,330 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Using NativeWifi

I am trying to use NativeWifi. I tried putting
"Using NativeWifi" in my C# code but it throws error right there.

I think I will need to add reference to my application. I don't know which
dll i need to import.

I have installed Windows SDK. Tried searching for Nativewifi.dll but could
not find it. There is a file Nativewifi.hxs but I don't know what that is or
how to use it.

Please help me get started.

thanks
Jun 27 '08 #1
1 7938
"Nighthawk" <bi******@hotmail.comwrote in message
news:E8**********************************@microsof t.com...
>I am trying to use NativeWifi. I tried putting
"Using NativeWifi" in my C# code but it throws error right there.

I think I will need to add reference to my application. I don't know which
dll i need to import.

I have installed Windows SDK. Tried searching for Nativewifi.dll but could
not find it. There is a file Nativewifi.hxs but I don't know what that is
or
how to use it.

Please help me get started.

thanks

The native Wifi API's are a set op native code libary API's NOT a set of
managed API's, so you can't use "using ..." .
To use native API's from C#, you'll need to use PInvoke, that means, you
will need to declare all API's, enums and native structures as managed
functions and types.

// WlanApi function declarations
[DllImport("Wlanapi.dll")]
static extern int WlanOpenHandle( int clientVersion, IntPtr reserved, out
int negotiatedVersion, out IntPtr clientHandle);
// usage
....
int clientVersion = 1; // XP SP2
int negotiatedVersion;
IntPtr clientHandle;
int error = WlanOpenHandle(clientVersion, IntPtr.Zero, out
negotiatedVersion, out clientHandle);
if(error != 0)
{
// function failed... inspect error number and throw
}
else
{
// use valid clientHandle in the other wlan API's, like WlanGetProfile,
WlanConnect etc....
....

Willy.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by rawCoder | last post: by
10 posts views Thread by Christopher Benson-Manica | last post: by
17 posts views Thread by beliavsky | last post: by
14 posts views Thread by john.burton.email | last post: by
5 posts views Thread by Enos Meroka | last post: by
12 posts views Thread by Calum Grant | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.