pwrmgr.cpp
来自「开启和关闭Mobile手机WIFI的源代码工程例子」· C++ 代码 · 共 29 行
CPP
29 行
//实现部分的电源功能
#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;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?