Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / April 2008

Tip: Looking for answers? Try searching our database.

Using NativeWifi

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nighthawk - 16 Apr 2008 16:14 GMT
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
Willy Denoyette [MVP] - 16 Apr 2008 16:47 GMT
>I am trying to use NativeWifi. I tried putting
> "Using NativeWifi" in my C# code but it throws error right there.
[quoted text clipped - 10 lines]
>
> 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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.