using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
using System.Runtime.InteropServices;
namespace StationInspection.Util
{
class WiFiHelper
{
[DllImport("coredll.dll", SetLastError = true)]
public static extern int SetDevicePower(string pvDevice, int dwDeviceFlags, DevicePowerState DeviceState);
public enum DevicePowerState : int
{
Unspecified = -1,
D0 = 0, // Full On: full power, full functionality
D1, // Low Power On: fully functional at low power/performance
D2, // Standby: partially powered with automatic wake
D3, // Sleep: partially powered with device initiated wake
D4, // Off: unpowered
}
public const int POWER_NAME = 0x00000001;
public static string FindDriverKey()
{
string ret = string.Empty;
//#defin
c#Windows Mobile WiFi开启和关闭
最新推荐文章于 2024-01-25 16:32:26 发布
这篇博客介绍了如何利用C#的DllImport特性调用Windows Mobile的coredll.dll库,通过FindDriverKey方法找到WiFi驱动的注册表项,并使用SetDevicePower方法切换设备到不同的电源状态来实现WiFi的开启和关闭。示例代码详细展示了具体实现过程。
摘要由CSDN通过智能技术生成