On Fri, 2007-10-12 at 15:31 +0200, Jacek M. Holeczek wrote:
I don't see anything fundamentally different on the non-CE version,
Well, I do.
Any attempt to call the "ChangeDisplaySettingsEx" with use of the "non-CE"
DEVMODE version (as you name it) returns an error. After many many hours
of fights ... I discovered that the DEVMODEW structure was completely
different from what WinCE expected. After I "patched" it, my code started
to work.

I didn't make myself clear, I guess.  I was not saying not to change it :)

I wrote:
>I don't see anything fundamentally different on the non-CE version,
>or are the _ANONYMOUS_UNION/_ANONYMOUS_STRUCT not doing their job?

I was refering specifically to the anonymous union/structs (which are
already in place), which allow you to have this:

struct A
{
        int tag;
        int field1;
        int field2;
        int field3;
};

... then, later you want to extend/tweak the struct, perhaps adding a
different tag, which has other fields of interest, and some others
unused.  You can do this with gcc:

struct A
{
        int tag;
        union
        {
                struct
                {
                        int field1;
                        int field2;
                        int field3;
                };
                int member1;
        };
};


And this will still work:
struct A a;
a.field1 = 0;

Looks very close to what was done in DEVMODE for 9x/NT, doesn't it?

Danny Backx wrote:
> Another way to code this might be the patch I'm attaching now. It
> removes the duplicate definition which is on MSDN but instead merges the
> differences.

Either that, or something like the attached would be fine.

Cheers,
Pedro Alves
Index: wingdi.h
===================================================================
--- wingdi.h	(revision 1057)
+++ wingdi.h	(working copy)
@@ -1182,10 +1182,20 @@ extern "C" {
 #define DM_PELSHEIGHT 0x00100000
 #define DM_DISPLAYFLAGS 0x00200000
 #define DM_DISPLAYFREQUENCY 0x00400000
+#ifndef _WIN32_WCE
 #define DM_ICMMETHOD 0x00800000
 #define DM_ICMINTENT 0x01000000
 #define DM_MEDIATYPE 0x02000000
 #define DM_DITHERTYPE 0x04000000
+#else /* _WIN32_WCE */
+#define DM_DISPLAYORIENTATION 0x00800000
+#define DM_DISPLAYQUERYORIENTATION 0x01000000
+#define DMDO_0 0
+#define DMDO_DEFAULT DMDO_0
+#define DMDO_90 1
+#define DMDO_180 2
+#define DMDO_270 4
+#endif /* _WIN32_WCE */
 #if(WINVER >= 0x0500)
 #define DM_PANNINGWIDTH 0x08000000
 #define DM_PANNINGHEIGHT 0x10000000
@@ -1541,9 +1551,11 @@ typedef struct _devicemodeW { 
       short dmDefaultSource; 
       short dmPrintQuality; 
     } DUMMYSTRUCTNAME;
+#ifndef _WIN32_WCE
     POINTL dmPosition;
     DWORD  dmDisplayOrientation;
     DWORD  dmDisplayFixedOutput;
+#endif
   } DUMMYUNIONNAME;
 
   short  dmColor; 
@@ -1558,9 +1570,14 @@ typedef struct _devicemodeW { 
   DWORD  dmPelsHeight; 
   _ANONYMOUS_UNION union {
     DWORD  dmDisplayFlags; 
+#ifndef _WIN32_WCE
     DWORD  dmNup;
+#endif
   } DUMMYUNIONNAME2;
   DWORD  dmDisplayFrequency; 
+#ifdef _WIN32_WCE
+  DWORD  dmDisplayOrientation;
+#else
 #if(WINVER >= 0x0400) 
   DWORD  dmICMMethod;
   DWORD  dmICMIntent;
@@ -1573,6 +1590,7 @@ typedef struct _devicemodeW { 
   DWORD  dmPanningHeight;
 #endif
 #endif /* WINVER >= 0x0400 */
+#endif /* _WIN32_WCE */
 } DEVMODEW,*LPDEVMODEW,*PDEVMODEW;
 typedef struct tagDIBSECTION {
 	BITMAP dsBm;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to