summaryrefslogtreecommitdiff
path: root/navit/gui/win32/ceglue.c
diff options
context:
space:
mode:
Diffstat (limited to 'navit/gui/win32/ceglue.c')
-rw-r--r--navit/gui/win32/ceglue.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/navit/gui/win32/ceglue.c b/navit/gui/win32/ceglue.c
index a0817f935..772eb782d 100644
--- a/navit/gui/win32/ceglue.c
+++ b/navit/gui/win32/ceglue.c
@@ -1,77 +1,77 @@
-#include <windows.h>
-#include "ceglue.h"
-
-BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
-
-void InitCeGlue (void)
-{
- HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
- if (ayg != NULL) {
- SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
- GetProcAddressW (ayg, TEXT ("SHFullScreen"));
- }
-}
-
-// code to turn of screen adopted from
-// http://msdn.microsoft.com/en-us/library/ms838354.aspx
-
-// GDI Escapes for ExtEscape()
-#define QUERYESCSUPPORT 8
-
-// The following are unique to CE
-#define GETVFRAMEPHYSICAL 6144
-#define GETVFRAMELEN 6145
-#define DBGDRIVERSTAT 6146
-#define SETPOWERMANAGEMENT 6147
-#define GETPOWERMANAGEMENT 6148
-
-
-typedef enum _VIDEO_POWER_STATE {
- VideoPowerOn = 1,
- VideoPowerStandBy,
- VideoPowerSuspend,
- VideoPowerOff
-} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
-
-
-typedef struct _VIDEO_POWER_MANAGEMENT {
- ULONG Length;
- ULONG DPMSVersion;
- ULONG PowerState;
-} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
-
-
-int CeEnableBacklight(int enable)
-{
- HDC gdc;
- int iESC=SETPOWERMANAGEMENT;
-
- gdc = GetDC(NULL);
- if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
- 0, NULL)==0)
- {
- MessageBox(NULL,
- L"Sorry, your Pocket PC does not support DisplayOff",
- L"Pocket PC Display Off Feature",
- MB_OK);
- ReleaseDC(NULL, gdc);
- return FALSE;
- }
- else
- {
- VIDEO_POWER_MANAGEMENT vpm;
- vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
- vpm.DPMSVersion = 0x0001;
- if (enable) {
- vpm.PowerState = VideoPowerOn;
- } else {
- vpm.PowerState = VideoPowerOff;
- }
- // Power off the display
- ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
- 0, NULL);
- ReleaseDC(NULL, gdc);
- return TRUE;
- }
-}
-
+#include <windows.h>
+#include "ceglue.h"
+
+BOOL FAR (*SHFullScreenPtr)(HWND hwnd, DWORD state) = NULL;
+
+void InitCeGlue (void)
+{
+ HINSTANCE ayg = LoadLibraryW (TEXT ("aygshell.dll"));
+ if (ayg != NULL) {
+ SHFullScreenPtr = (BOOL (*)(HWND, DWORD))
+ GetProcAddressW (ayg, TEXT ("SHFullScreen"));
+ }
+}
+
+// code to turn of screen adopted from
+// http://msdn.microsoft.com/en-us/library/ms838354.aspx
+
+// GDI Escapes for ExtEscape()
+#define QUERYESCSUPPORT 8
+
+// The following are unique to CE
+#define GETVFRAMEPHYSICAL 6144
+#define GETVFRAMELEN 6145
+#define DBGDRIVERSTAT 6146
+#define SETPOWERMANAGEMENT 6147
+#define GETPOWERMANAGEMENT 6148
+
+
+typedef enum _VIDEO_POWER_STATE {
+ VideoPowerOn = 1,
+ VideoPowerStandBy,
+ VideoPowerSuspend,
+ VideoPowerOff
+} VIDEO_POWER_STATE, *PVIDEO_POWER_STATE;
+
+
+typedef struct _VIDEO_POWER_MANAGEMENT {
+ ULONG Length;
+ ULONG DPMSVersion;
+ ULONG PowerState;
+} VIDEO_POWER_MANAGEMENT, *PVIDEO_POWER_MANAGEMENT;
+
+
+int CeEnableBacklight(int enable)
+{
+ HDC gdc;
+ int iESC=SETPOWERMANAGEMENT;
+
+ gdc = GetDC(NULL);
+ if (ExtEscape(gdc, QUERYESCSUPPORT, sizeof(int), (LPCSTR)&iESC,
+ 0, NULL)==0)
+ {
+ MessageBox(NULL,
+ L"Sorry, your Pocket PC does not support DisplayOff",
+ L"Pocket PC Display Off Feature",
+ MB_OK);
+ ReleaseDC(NULL, gdc);
+ return FALSE;
+ }
+ else
+ {
+ VIDEO_POWER_MANAGEMENT vpm;
+ vpm.Length = sizeof(VIDEO_POWER_MANAGEMENT);
+ vpm.DPMSVersion = 0x0001;
+ if (enable) {
+ vpm.PowerState = VideoPowerOn;
+ } else {
+ vpm.PowerState = VideoPowerOff;
+ }
+ // Power off the display
+ ExtEscape(gdc, SETPOWERMANAGEMENT, vpm.Length, (LPCSTR) &vpm,
+ 0, NULL);
+ ReleaseDC(NULL, gdc);
+ return TRUE;
+ }
+}
+