|
void WifiOn()
{
DevicePowerNotify(_T("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\WLAGS46F1"), D0, POWER_NAME);
SetDevicePower(_T("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\WLAGS46F1"), POWER_NAME, D0);
}
void WifiOff()
{
DevicePowerNotify(_T("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\WLAGS46F1"), D4, POWER_NAME);
SetDevicePower(_T("{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\WLAGS46F1"), POWER_NAME, D4);
}
//实现部分的电源功能
#include "pwrmgr.h"
typedef DWORD (__stdcall *DevicePowerNotifyProc)(PVOID,CEDEVICE_POWER_STATE,DWORD);
typedef DWORD (__stdcall *SetDevicePowerProc)(PVOID,DWORD,CEDEVICE_POWER_STATE);
DWORD DevicePowerNotify(PVOID pvDevice,CEDEVICE_POWER_STATE DeviceState,DWORD Flags)
{
HINSTANCE hCoreDll = LoadLibrary(_T("coredll.dll"));
DevicePowerNotifyProc procSet =
(DevicePowerNotifyProc)GetProcAddress(hCoreDll, _T("DevicePowerNotify"));
DWORD dwResult = procSet(pvDevice,DeviceState,Flags);
::FreeLibrary(hCoreDll);
return dwResult;
}
DWORD SetDevicePower(PVOID pvDevice,DWORD dwDeviceFlags,CEDEVICE_POWER_STATE dwState)
{
HINSTANCE hCoreDll = LoadLibrary(_T("coredll.dll"));
SetDevicePowerProc procSet =
(SetDevicePowerProc)GetProcAddress(hCoreDll, _T("SetDevicePower"));
DWORD dwResult = procSet(pvDevice,dwDeviceFlags,dwState);
::FreeLibrary(hCoreDll);
return dwResult;
}
加分给源码。。。。。。。。。。。 |
|