c# - Turn ON radio using wlan api -
i have requirement turn off wireless radio using wlanapi in c#
. iam able turn off radio not able turn on. here code:
wlan_phy_radio_state wlan_intf_opcode_radio_state = new wlan_phy_radio_state(); wlan_intf_opcode_radio_state.dwphyindex = 0; // todo : can change ??? wlan_intf_opcode_radio_state.dot11hardwareradiostate = dot11_radio_state.dot11_radio_state_on;// ignored in fact, according http://msdn.microsoft.com/en-us/library/windows/desktop/ms706791(v=vs.85).aspx wlan_intf_opcode_radio_state.dot11softwareradiostate = dot11_radio_state.dot11_radio_state_on; radiostateptr = marshal.allochglobal(marshal.sizeof(wlan_intf_opcode_radio_state)); marshal.structuretoptr(wlan_intf_opcode_radio_state, radiostateptr, false); if (wlanenuminterfaces(handle, intptr.zero, out ppinterfacelist) == error_success) { interfacelist = new wlan_interface_info_list(ppinterfacelist); (int = 0; < interfacelist.dwnumberofitems; i++) { guid pinterfaceguid = ((wlan_interface_info)interfacelist.interfaceinfo[0]).interfaceguid; if (wlansetinterface(handle, ref pinterfaceguid, wlan_intf_opcode.wlan_intf_opcode_radio_state, datasize, ref ptr, intptr.zero) == error_success) messagebox.show("yes"); else messagebox.show("some issue"); } }
definition :
[dllimport("wlanapi.dll", setlasterror = true)] public static extern uint wlansetinterface(intptr hclienthandle, ref guid pinterfaceguid, wlan_intf_opcode opcode, uint dwdatasize, ref intptr pdata, intptr preserved);
everything going smooth mean wlansetinterface function returning error_success
radio not swithching on in pc.please missed ?
i fallowed how can turn on radio of wifi adapter off?
Comments
Post a Comment