|
我的代码如下
void ClcdextDlg::OnBnClickedButton1()
{
HDC ghDisplayDC =::GetDC(NULL); //取得SCREEN句柄
//this->GetDC()->GetSafeHdc(); //CreateDC(NULL,NULL,NULL,NULL);
int fQueryEsc = SETPOWERMANAGEMENT;
int rc = ExtEscape (ghDisplayDC, QUERYESCSUPPORT, sizeof (fQueryEsc), //查询是否支持SETPOWERMANAGEMENT
(LPSTR)&fQueryEsc, 0, 0);
if (rc == 0)
{
AfxMessageBox(_T("不支持SETPOWERMANAGEMENT"));
}
if(NULL == ghDisplayDC)
{
m_err = -1; //edit控件显示
UpdateData(FALSE);
}
else
{
VIDEO_POWER_MANAGEMENT vpm;
vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
vpm.DPMSVersion = 1;
vpm.PowerState = VideoPowerOff;
int errv = ExtEscape(ghDisplayDC,SETPOWERMANAGEMENT,sizeof(vpm)+2,(LPSTR )&vpm,0,NULL);
m_err = GetLastError();
UpdateData(FALSE);
}
/* //其他模块电源控制,可正常工作,屏蔽
DevicePowerNotify(_T("WAV1:"), D4, POWER_NAME);
HWAV = SetPowerRequirement(TEXT( "WAV1:"),D4,POWER_NAME,NULL,0);
DevicePowerNotify(_T("MFC1:"), D4, POWER_NAME);
HMFC = SetPowerRequirement(TEXT( "MFC1:"),D4,POWER_NAME,NULL,0);
DevicePowerNotify(_T("GLE1:"), D4, POWER_NAME);
HGLE = SetPowerRequirement(TEXT( "GLE1:"),D4,POWER_NAME,NULL,0);
DevicePowerNotify(_T("DSK3:"), D4, POWER_NAME);
HDSK = SetPowerRequirement(TEXT( "DSK3:"),D4,POWER_NAME,NULL,0);
DevicePowerNotify(_T("IIC0:"), D4, POWER_NAME);
HDSK = SetPowerRequirement(TEXT( "IIC0:"),D4,POWER_NAME,NULL,0);
DevicePowerNotify(_T("NDS0:"), D4, POWER_NAME);
HDSK = SetPowerRequirement(TEXT( "NDS0:"),D4,POWER_NAME,NULL,0);
*/
}
执行到int errv = ExtEscape(ghDisplayDC,SETPOWERMANAGEMENT,sizeof(vpm)+2,(LPSTR )&vpm,0,NULL);
m_err = GetLastError();
的时候,返回错误信息为2,不知道该如何修改? |
|