source: subversion/applications/rendering/gosmore/ceglue.c @ 10572

Last change on this file since 10572 was 10572, checked in by nic, 11 years ago

Fix access=no ...=yes (requires rebuild). Improve highway=primary.
WinCE: Add untested DisplayOff? option.
WinCE: Add Portuguese translations.
WinCE: Fix rendering of edits.

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#include <windows.h>
2#include "ceglue.h"
3
4BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
5
6void InitCeGlue (void)
7{
8  HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
9  if (ayg != NULL) {
10    SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
11      GetProcAddressW (ayg, TEXT ("SHFullScreen"));
12  }
13}
14
15// code to turn of screen adopted from
16// http://msdn.microsoft.com/en-us/library/ms838354.aspx
17
18// GDI Escapes for ExtEscape()
19#define QUERYESCSUPPORT    8
20 
21// The following are unique to CE
22#define GETVFRAMEPHYSICAL   6144
23#define GETVFRAMELEN    6145
24#define DBGDRIVERSTAT    6146
25#define SETPOWERMANAGEMENT   6147
26#define GETPOWERMANAGEMENT   6148
27 
28 
29typedef enum _VIDEO_POWER_STATE {
30    VideoPowerOn = 1,
31    VideoPowerStandBy,
32    VideoPowerSuspend,
33    VideoPowerOff
34} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
35 
36 
37typedef struct _VIDEO_POWER_MANAGEMENT {
38    ULONG Length;
39    ULONG DPMSVersion;
40    ULONG PowerState;
41} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
42
43
44int CeEnableBacklight(int enable)
45{
46  HDC gdc;
47  int iESC=SETPOWERMANAGEMENT;
48
49  gdc = GetDC(NULL);
50  if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC, 
51      0, NULL)==0)
52  {
53    MessageBox(NULL,
54                L"Sorry, your Pocket PC does not support DisplayOff",
55                L"Pocket PC Display Off Feature",
56              MB_OK);
57    ReleaseDC(NULL, gdc);
58    return FALSE;
59  }
60  else
61  {
62    VIDEO_POWER_MANAGEMENT vpm;
63    vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
64    vpm.DPMSVersion = 0x0001;
65    if (enable) {
66      vpm.PowerState = VideoPowerOn;
67    } else {
68      vpm.PowerState = VideoPowerOff;
69    }
70    // Power off the display
71    ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm, 
72              0, NULL);
73    ReleaseDC(NULL, gdc);
74    return TRUE;
75  }
76}
77
Note: See TracBrowser for help on using the repository browser.