Re: Windows - DEVMODE

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message ----- 
From: "Evan Marshall" <1evan at sbcglobal.net>
To: <EUforum at topica.com>
Subject: Windows - DEVMODE


> 
> 
> The following bit of code is supposed to set the screen resolution to 
> 640X480 but it doesn't change.  (I have my screen set to 1024X768)
> This works when I code it in C.  Therefor, I believe I may have the 
> wrong offsets for the structure members, but I'm not sure.
> 
> dmScreenSettings = allocate(148)  --DEVMODE structure
> mem_set(dmScreenSettings,0,148)  --clear smScreenSettings
> poke(dmScreenSettings + 36,148)   --dmSize
> poke4(dmScreenSettings + 
> 40,or_all({DM_BITSPERPEL,DM_PELSWIDTH,DM_PELSHEIGHT}))  -- dmFields
> poke4(dmScreenSettings + 91, 24)  -- dmBitsPerPel
> poke4(dmScreenSettings + 95, 640)   --dmPelWidth
> poke4(dmScreenSettings + 99, 480)  --dmPelHeight
> if c_func(ChangeDisplaySettingsA,{dmScreenSettings,CDS_FULLSCREEN}) != 
> DISP_CHANGE_SUCCESSFUL then
>         retval =  message_box("The requested fullscreen mode is not 
> supported by\nyour video card. ", "Error", or_bits(MB_OK,MB_ICONSTOP))
> end if

Maybe you do have the offsets incorrect. Here is wha I make them to be...

typedef struct _devicemode {    /* dvmd */
  0    TCHAR  dmDeviceName[32];
 32    WORD   dmSpecVersion;
 34    WORD   dmDriverVersion;
 36    WORD   dmSize;
 38    WORD   dmDriverExtra;
 40    DWORD  dmFields;
 44    short  dmOrientation;
 46    short  dmPaperSize;
 48    short  dmPaperLength;
 50    short  dmPaperWidth;
 52    short  dmScale;
 54    short  dmCopies;
 56    short  dmDefaultSource;
 58    short  dmPrintQuality;
 60    short  dmColor;
 62    short  dmDuplex;
 64    short  dmYResolution;
 66    short  dmTTOption;
 68    short  dmCollate;
 70    TCHAR  dmFormName[32];
102    WORD   dmUnusedPadding;
104    USHORT dmBitsPerPel;
106    DWORD  dmPelsWidth;
110    DWORD  dmPelsHeight;
114    DWORD  dmDisplayFlags;
118    DWORD  dmDisplayFrequency;
122    (sizeof)
} DEVMODE

This is why I use the allot(), fetch() and store() routines in win32lib. These
do the math for me.
-- 
Derek

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu