source: subversion/applications/rendering/gosmore/jni/ceglue.c @ 34655

Last change on this file since 34655 was 27324, checked in by nic, 8 years ago

Rearrange files

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