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

Last change on this file since 12233 was 12233, checked in by daviddean, 11 years ago

Fixed logprintf so timestamps work in WinCE
WinCE spoken directions are now asynchronous, so no pausing while speaking
Fixed transparency issues on some icons (rebuild probably required)
Add created_by=gosmore to allow easier marking of changes in JOSM
Search dialog now uses entire screen real-estate, will do other dialogs soon
Edits weren't saving in the right place when no GPS connected
Non-GPS-connected edits now save with GMT date and time taken from computer

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