Author Topic: stuck on this error about DEVMODE settings  (Read 2580 times)

0 Members and 1 Guest are viewing this topic.

kryton9

  • Guest
stuck on this error about DEVMODE settings
« on: June 18, 2011, 10:08:37 AM »
I am about half way finished converting my glwindow class to oxygen with the help of your header file conversion Charles. I am doing compiles along the way and trying to fix problems as they occur.
But this one I am stuck on. It knows about DEVMODE as it didn't give any errors till the 4th line. Here is the Error message.
Not found : screensettings.dmpelswidth

Here is the segment of code it comes from:

Code: OxygenBasic
  1. DEVMODE screenSettings;
  2.                 memset( &screenSettings, 0, sizeof( screenSettings ) )
  3.                 screenSettings.dmSize = sizeof( screenSettings )
  4.                 screenSettings.dmPelsWidth = Width
  5.                 screenSettings.dmPelsHeight = Height
  6.                 screenSettings.dmBitsPerPel = Bits
  7.                 screenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT

I also couldn't use a variable named Left. It gave a message that seems like it is treating it as function Left("Word",2)  so for now I just named it Lft :)


Charles Pegge

  • Guest
Re: stuck on this error about DEVMODE settings
« Reply #1 on: June 18, 2011, 12:36:48 PM »

Hi Kent,

This DEVMODE structure is a can of worms which I thought I had cracked back in December, but here is a simplified Basic definition that Peter and I have used.

memset is not required since Basic initialises a variable will nulls.

Code: OxygenBasic
  1. % CCDEVICENAME  = 32
  2. % CFORMNAME     = 32
  3. % DM_PELSWIDTH  = &H80000
  4. % DM_PELSHEIGHT = &H100000
  5.  
  6.  
  7.  
  8. Type DEVMODE
  9.  zstring dmDeviceName[32]    '00 'itr array itr macro
  10. dmSpecVersion   as short    '32
  11. dmDriverVersion as short    '34
  12. dmSize          as short    '36
  13. dmDriverExtra   as short    '38
  14. dmFields        As Long     '40
  15. dmOrientation   as short    '44
  16. dmPaperSize     as short    '46
  17. dmPaperLength   as short    '48
  18. dmPaperWidth    as short    '50
  19. dmScale         as short    '52
  20. dmCopies        as short    '54
  21. dmDefaultSource as short    '56
  22. dmPrintQuality  as short    '58
  23. dmColor         as short    '60
  24. dmDuplex        as short    '62
  25. dmYResolution   as short    '64
  26. dmTTOption      as short    '66
  27. dmCollate       as short    '68
  28. zstring dmFormName[32]      '70 'itr array itr macro
  29. dmUnusedPadding as short    '102
  30. dmBitsPerPel    as Long     '104 'was short
  31. dmPelsWidth     As Long     '108
  32. dmPelsHeight    As Long     '112
  33. dmDisplayFlags  As Long     '116
  34. dmDisplayFrequency As Long  '120
  35. sys reserved[33]            '124
  36.                             '256
  37. End Type
  38.  
  39.  

Charles



Charles Pegge

  • Guest
Re: stuck on this error about DEVMODE settings
« Reply #2 on: June 18, 2011, 01:15:44 PM »
This is the original. It requires a few extra definitions like POINTL to work but I confirm it gets the offsets as per the BASIC version.

Code: OxygenBasic
  1.  
  2. % CCDEVICENAME  = 32
  3. % CFORMNAME     = 32
  4. % DM_PELSWIDTH  = &H80000
  5. % DM_PELSHEIGHT = &H100000
  6.  
  7.  
  8. typedef struct _POINTL {
  9.   LONG x;
  10.   LONG y;
  11. } POINTL, *PPOINTL;
  12.  
  13.  
  14. #define CCHDEVICENAME 32
  15. #define CCHFORMNAME   32
  16.  
  17. typedef zstring TCHAR
  18.  
  19.  
  20. typedef struct _devicemode {
  21.   TCHAR dmDeviceName[CCHDEVICENAME];
  22.   WORD  dmSpecVersion;
  23.   WORD  dmDriverVersion;
  24.   WORD  dmSize;
  25.   WORD  dmDriverExtra;
  26.   DWORD dmFields;
  27.   union {
  28.     struct {
  29.       short dmOrientation;
  30.       short dmPaperSize;
  31.       short dmPaperLength;
  32.       short dmPaperWidth;
  33.       short dmScale;
  34.       short dmCopies;
  35.       short dmDefaultSource;
  36.       short dmPrintQuality;
  37.     };
  38.     struct {
  39.       POINTL dmPosition;
  40.       DWORD  dmDisplayOrientation;
  41.       DWORD  dmDisplayFixedOutput;
  42.     };
  43.   };
  44.   short dmColor;
  45.   short dmDuplex;
  46.   short dmYResolution;
  47.   short dmTTOption;
  48.   short dmCollate;
  49.   TCHAR dmFormName[CCHFORMNAME];
  50.   WORD  dmLogPixels;
  51.   DWORD dmBitsPerPel;
  52.   DWORD dmPelsWidth;
  53.   DWORD dmPelsHeight;
  54.   union {
  55.     DWORD dmDisplayFlags;
  56.     DWORD dmNup;
  57.   };
  58.   DWORD dmDisplayFrequency;
  59. '#if (WINVER >= 0x0400)
  60.   DWORD dmICMMethod;
  61.    DWORD dmICMIntent;
  62.    DWORD dmMediaType;
  63.    DWORD dmDitherType;
  64.    DWORD dmReserved1;
  65.    DWORD dmReserved2;
  66. '#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
  67.   DWORD dmPanningWidth;
  68.    DWORD dmPanningHeight;
  69. '#endif
  70. '#endif
  71. } DEVMODE, *PDEVMODE, *LPDEVMODE;
  72.  
  73.  
  74. 'TESTS
  75. '=====
  76.  
  77. #recordof _devicemode
  78.  
  79. devmode d
  80.  
  81. print d.dmpelswidth
  82.  
  83.  

Charles

kryton9

  • Guest
Re: stuck on this error about DEVMODE settings
« Reply #3 on: June 18, 2011, 04:27:58 PM »
Charles, this looks like code that should be in an oxygen file somewhere as it is core stuff... is it or should I paste it into my code each time I need it?

For now I pasted it and remmed out the memset call, but now getting a different error.
What I will do is finish my translation to oxygen, then post it up for you to go over.
It will be easier for you troubleshoot seeing all the code than in segments.

Thanks.