Author Topic: Logo3D  (Read 3377 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Logo3D
« on: December 05, 2010, 10:21:54 AM »
Deleted
« Last Edit: April 14, 2015, 03:35:10 AM by Peter »

kryton9

  • Guest
Re: Logo3D
« Reply #1 on: December 05, 2010, 03:27:13 PM »
Neat idea for a logo. I like the infinity sign as a symbolic B with the O in the middle.

Charles Pegge

  • Guest
Re: Logo3D
« Reply #2 on: December 06, 2010, 03:37:32 AM »

Thanks for the Logo Design Peter :)

I've investigated DevMode and found there are a few problems to deal with but I got it to read the structure correctly with this type definition:

Code: [Select]
Type DEVMODE
 zstring dmDeviceName[32]    '00 'itr array itr macro
 dmSpecVersion   as short    '32
 dmDriverVersion as short    '34
 dmSize          as short    '36
 dmDriverExtra   as short    '38
 dmFields        As Long     '40
 dmOrientation   as short    '44
 dmPaperSize     as short    '46
 dmPaperLength   as short    '48
 dmPaperWidth    as short    '50
 dmScale         as short    '52
 dmCopies        as short    '54
 dmDefaultSource as short    '56
 dmPrintQuality  as short    '58
 dmColor         as short    '60
 dmDuplex        as short    '62
 dmYResolution   as short    '64
 dmTTOption      as short    '66
 dmCollate       as short    '68
 zstring dmFormName[32]      '70 'itr array itr macro
 dmUnusedPadding as short    '102
 dmBitsPerPel    as Long     '104 'was short
 dmPelsWidth     As Long     '108
 dmPelsHeight    As Long     '112
 dmDisplayFlags  As Long     '116
 dmDisplayFrequency As Long  '120
                             '124
End Type

I will need to do some further work so it also reads the original C definition correctly.

Using the rest of your code, it successfully changed the screen pixel format to 800X600 and then restored the screen to its original settings.

Charles

Charles Pegge

  • Guest
Re: Logo3D
« Reply #3 on: December 07, 2010, 12:28:23 AM »

Peter,

Here is the script I am using. I have added some extra padding to the DEVMODE structure in case there are extra params being written into it, causing corruption.

I have left in some of the diagnostics. (My video has 108 display modes!)

I changed "boolean" to "bool" but this should not cause your problem since the this type would default to "sys"

Code: [Select]
% CCDEVICENAME  = 32
% CFORMNAME     = 32
% DM_PELSWIDTH  = &H80000
% DM_PELSHEIGHT = &H100000


/*
#define CCHDEVICENAME 32
#define CCHFORMNAME   32

typedef zstring TCHAR

typedef struct _devicemode {
  zstring dmDeviceName[32] '0 CCHDEVICENAME
  WORD  dmSpecVersion       '32
  WORD  dmDriverVersion     '34
  WORD  dmSize              '36
  WORD  dmDriverExtra       '38
  DWORD dmFields            '40
  union {
    struct {
      short dmOrientation   '44
      short dmPaperSize     '46
      short dmPaperLength   '48
      short dmPaperWidth    '50
      short dmScale         '52
      short dmCopies        '54
      short dmDefaultSource '56
      short dmPrintQuality  '58
    } ;
    struct {
      POINTL dmPosition     '44
      DWORD  dmDisplayOrientation '52
      DWORD  dmDisplayFixedOutput '56
    } ;
  } ;
  short dmColor                 '60
  short dmDuplex                '62
  short dmYResolution           '64
  short dmTTOption              '66
  short dmCollate               '68
  TCHAR dmFormName[CCHFORMNAME] '70
  WORD  dmLogPixels             '102
  DWORD dmBitsPerPel            '104
  DWORD dmPelsWidth             '108
  DWORD dmPelsHeight            '112
  union {
    DWORD dmDisplayFlags        '116
    DWORD dmNup                 '116
  } ;
  DWORD dmDisplayFrequency      '120
#if (WINVER >= 0x0400)
  DWORD dmICMMethod;
  DWORD dmICMIntent;
  DWORD dmMediaType;
  DWORD dmDitherType;
  DWORD dmReserved1;
  DWORD dmReserved2;
#if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
  DWORD dmPanningWidth;
  DWORD dmPanningHeight;
#endif
#endif
} DEVMODE, *PDEVMODE, *LPDEVMODE;

*/


 
Type DEVMODE
 zstring dmDeviceName[32]    '00 'itr array itr macro
 dmSpecVersion   as short    '32
 dmDriverVersion as short    '34
 dmSize          as short    '36
 dmDriverExtra   as short    '38
 dmFields        As Long     '40
 dmOrientation   as short    '44
 dmPaperSize     as short    '46
 dmPaperLength   as short    '48
 dmPaperWidth    as short    '50
 dmScale         as short    '52
 dmCopies        as short    '54
 dmDefaultSource as short    '56
 dmPrintQuality  as short    '58
 dmColor         as short    '60
 dmDuplex        as short    '62
 dmYResolution   as short    '64
 dmTTOption      as short    '66
 dmCollate       as short    '68
 zstring dmFormName[32]      '70 'itr array itr macro
 dmUnusedPadding as short    '102
 dmBitsPerPel    as Long     '104 'was short
 dmPelsWidth     As Long     '108
 dmPelsHeight    As Long     '112
 dmDisplayFlags  As Long     '116
 dmDisplayFrequency As Long  '120
 sys reserved[33]            '124
                             '256
End Type

 
Declare Function EnumDisplaySettings Lib "user32" Alias "EnumDisplaySettingsA" (ByVal lpszDeviceName As Long, ByVal iModeNum As Long, lpDevMode As DevMode) As bool
Declare Function ChangeDisplaySettings Lib "user32" Alias "ChangeDisplaySettingsA" (lpDevMode As DevMode, ByVal dwflags As Long) As Long

Dim DevM As DEVMODE
Dim a, i, b, TmpW, TmpH As Long

i = 0

Do
a = EnumDisplaySettings(0, i, DevM)   '&DevM !
iF a =0 Then Exit Do
i = i + 1
End Do

print "Number of Screen Modes: " i

'----
'cr=chr(13)+chr(10)
'pr="dev data:" cr cr
'long * d : &d=DevM
'for i=18 to 31 : pr+=hex(d[i]) cr : next
'print pr
'----

TmpW = DevM.dmPelsWidth
TmpH = DevM.dmPelsHeight

'print structureof DevM

'print "  " tmpw "  " tmph

DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth  = 800
DevM.dmPelsHeight = 600
b = ChangeDisplaySettings(DevM, 0) '&DevM !

print "ok"

'previous resolution !
DevM.dmFields = DM_PELSWIDTH Or DM_PELSHEIGHT
DevM.dmPelsWidth  = TmpW
DevM.dmPelsHeight = TmpH
b = ChangeDisplaySettings(DevM, 0) '&DevM !
'b = ChangeDisplaySettings(0, 0) '&DevM !

print "ok"

Charles

Charles Pegge

  • Guest
Re: Logo3D
« Reply #4 on: December 07, 2010, 03:56:53 AM »
Thanks Peter.

This works fine on my Vista 64. I don't think you will have any problem under XP either.

Charles