📄 pwrmgr.cpp
字号:
//实现部分的电源功能
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -