Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Screen resolution
Message
From
07/09/2015 07:43:17
 
 
To
06/09/2015 01:36:28
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01624301
Message ID:
01624343
Views:
89
The procedure needs to be called with one parameter, which is the number of pixels for the new resolution to set. You can of course hardcode it and replace tnResolution with the number of pixels. Otherwise call the procedure like this:
ScreenResolution(1024)
>thanks Christian
>I am experimenting with it - way over my head i'm afraid but I will give it a try - I loaded the libraries - have not altered anything in your programming at this point and am getting error read on this line
>
>IF loStruct.dmPelsWidth = tnResolution AND ;
>			loStruct.dmBitsPerPel = 32
>
>
>[operator/operand type mismatch.]
>
>can you give me some suggestions on how to proceed. thanks
>
>k
>
>
>>I used a code for that, you need to adjust to your own situation.
>>It makes use of Struct.VCX and WinStruct.vcx libraries.
>>
>>
>>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 )
>>
>>
>>Hope that helps.
>>
>>>Just bought new mini laptop 13.3 with optimal screen resolution 1920x1080. However I need to change that setting to 1280x800 to view all data in VFP window.
>>>
>>>Is there an initial setting I can change in VFP settings or set up programmatically so that when I start VFP it will change the screen resolution to 1280x800 either for VFP alone or for the whole laptop configuration.
>>>
>>>tnx k
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform