很久以前我就问过这个问题,也去MS的WINCE新闻组里问过,都没有得到满意的答案.
网上一般都是采用Extescape的方法,当然这个也将是以后的标准方法.
我参照网上的代码写了一个函数.
//----------------------------------------------------------------------
// SetVideoPower - Turns on or off the display
//
int SetVideoPower (BOOL fOn) {
VIDEO_POWER_MANAGEMENT vpm;
int rc, fQueryEsc;
HDC hdc;
// Get the display dc.
hdc = GetDC (NULL);
// See if supported.
fQueryEsc = SETPOWERMANAGEMENT;
rc = ExtEscape (hdc, QUERYESCSUPPORT, sizeof (fQueryEsc),
(LPSTR)&fQueryEsc, 0, 0);
if (rc == 0) {
// No support, fail.
ReleaseDC (NULL, hdc);
return -1;
}
// Fill in the power management structure.
vpm.Length = sizeof (vpm);
vpm.DPMSVersion = 1;
if (fOn)
vpm.PowerState = VideoPowerOn;
else
vpm.PowerState = VideoPowerOff;
// Tell the driver to turn on or off the display.
rc = ExtEscape (hdc, SETPOWERMANAGEMENT, sizeof (vpm),
(LPSTR)&vpm, 0, 0);
// Always release what you get.
ReleaseDC (NULL, hdc);
return 0;
}
每当执行到
rc = ExtEscape (hdc, QUERYESCSUPPORT, sizeof (fQueryEsc),
(LPSTR)&fQueryEsc, 0, 0);
时返回总是0,也就是说,我的显驱不支持ExtEscape这个函数.
请问,还有不用到这个函数的其它方法吗?
我想肯定是有的,比如对LCD端口的电源管理等.
哪位DX有好的方法没?
我给你发了短消息了