IF loStruct.dmPelsWidth = tnResolution AND ;
loStruct.dmBitsPerPel = 32
[operator/operand type mismatch.]>PROCEDURE ScreenResolution >* >*-- The parameter is the width of the screen in pixels. >LPARAMETERS tnResolution >* >*-- We use the following two libraries: One to >*-- get the available display settings (not that >*-- we are interested in that, but we need to create >*-- the structure). >*-- The other to change the setting. If the change fails, >*-- it will just not take the change into effect. >* >Declare Integer EnumDisplaySettings in Win32API ; > String lpszDeviceName, ; > Integer iModeNum, ; > String @lpDevMode >* >Declare Integer ChangeDisplaySettings in Win32API ; > String @lpDevMode, ; > Integer dwflags >* >*-- Two class libraries, from FoxCode.COM. >* >Set ClassLib to Struct, WinStruct Additive >loStruct = NEWOBJECT("DevMode") >* >*-- First create the structure using the current >*-- display setting. >Local lcDMCurrent >loStruct.dmSize = loStruct.SizeOf() >loStruct.dmDriverExtra = 0 >lcDMCurrent = loStruct.GetString() >EnumDisplaySettings( NULL, -1, @lcDMCurrent) >loStruct.SetString( m.lcDMCurrent) >lnCurrentWidth = loStruct.dmPelsWidth >* >*-- Now search in the available settings for the one >*-- that we wanted to set. We find the match by comparing >*-- the display width in pixels with the parameter. >Local lnMode, lcDevMode, lnOK, lnLastColor >lnMode = 0 >lcDevMode = loStruct.GetString() >lnLastColor = 0 >Do While .T. > m.lnOK = EnumDisplaySettings( NULL, m.lnMode, @lcDevMode ) > loStruct.SetString( m.lcDevMode) > IF loStruct.dmPelsWidth = tnResolution AND ; > loStruct.dmBitsPerPel = 32 > lcDMCurrent = loStruct.GetString() > ENDIF > * > If m.lnOK == 0 > *-- That means we had the last available one. > Exit > Endif > * > *-- Check the next higher one. > lnMode = m.lnMode + 1 >Enddo >* >loStruct.SetString( m.lcDMCurrent) >#DEFINE DM_BITSPERPEL 0x00040000 >#DEFINE DM_PELSWIDTH 0x00080000 >#DEFINE DM_PELSHEIGHT 0x00100000 >loStruct.dmFields = DM_BITSPERPEL + DM_PELSWIDTH + DM_PELSHEIGHT >lcDMCurrent = loStruct.GetString() >ChangeDisplaySettings( @lcDMCurrent, 0 ) >>