⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pwrmgr.cpp

📁 一个手机版本开关无线网络的程序
💻 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 + -