Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing the Windows screen resolution

Status
Not open for further replies.

mohrorless

Programmer
Mar 5, 2002
52
US
Hi!

Has anyone ever changed the screen throught VFP? I can do it in VB - a few API calls and you are there, but when I try to translate the VB code to VFP I am running into a few problems. First in the VB code you can create a User Defined Type to hold the display settings. Modify the particular settings, API it back to windows and you're done. The first problem I am having is trying to figure out how to do the same in VFP. When I get that figured out there will probably be some other problems to work out.

Any ideas?????? [spidey] [americanflag] [unclesam]
 
mohrorless

Any ideas??????

Yes, although I wouldn't recommend it.
1. The user "normally" set the screen resolution o his liking.
2. You could cause problem if the video card doesn't support the resolution.

I would suggest to check the SYSMETRIC(1), and if your app need to run at a higher or lower resolution, just use a message.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
While VFP doesn't natively support structures for API calls, there are a couple solutions in the Universal Thread download area. (
However, I aggree with Mike, unless you have an application that runs exclusively on Windows, it's usually considered "rude" to switch the resolution and/or the color depth on a system that the user has set up the defaults they prefer or need.

Rick
 
I'm sorry. I didn't fuly explain myself. What we are planning on doing is changing the resolution when the system starts up then changing it back when the user is done with it. The users we have here have a variety of machines, some new, but mostly hand me downs that have a variety of screen resolutions on them. Most of the users don't know how to change the resolution and just stick with what's on the screen at the time they get the pc (there are even quite a few that are quite afraid of the computers & just don't want to screw anything up - so they won't change anything out of fear of breaking it - even if they don't like it the way it is). The program requirements that we are given for the project require us to put a number of fields on several of the screens. Unfortunately the screen size required to do this is bigger than an 800x600 resolution will allow on the screen at once. 1024x768 will work just fine. A project I did in VB had similar requirements and was a success with the screen resolution changing. The users had no problem with the resolution changing, as long as it changed back when they were done with the system.

Since it would only be for the time the user is actually running the app, it would not be a problem. It would only be done on an as needed by the system basis anyway.

Thanks & sorry I wasn't a little clearer!

John [spidey] [americanflag] [unclesam]
 
Go to click on the Download picture on the left, and choose the Visual FoxPro
area. Next enter 'struct' (without the quotes) in the Title area and press Enter. You should get back an entry for:
struct.zip - "A Visual FoxPro class to simplify packing and unpacking of structures for use in WINAPI functions or other DLLs. Code is included."
There is excellent documentation on it's use in a .DOC file.

Then you can use the same API calls you did in VB.

Rick
 
I'm currently writing a class that does the same thing, so if you haven't found the solution by the time I've finished, I'd be glad to share it with you. I'm scheduled to have it done in the next 2-3 weeks.


BTW. It requires heavy use of the API calls.
is a good source of info on VFP -> WinAPI calls

Darrell 'We all must do the hard bits so when we get bit we know where to bite' :)
 
mohrorless

Declare Integer ChangeDisplaySettings in Win32API ;
String @lpDevMode, ;
Integer dwflags

ChangeDisplaySettings( @lcDevMode, 0 )

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Mike:

You also need to tell windows to tell all apps that the screen resolution is changing which allows them to redraw themselves.

This of course assumes there is more than the VFP app up and running.

That's why I decided to write a class that will detect most problems that may be caused by switching resolutions. (I've had issues with it in multi-app settings)

Darrell

P.S. I've been playing with your:

... FOR lnRow = 0 TO ThisForm.Height
ThisForm.ForeColor = RGB(0,0,255-255*lnRow/ThisForm.Height) ...

to create a cool thermometer.

I'll send it off to you at some point when they let me out of my sand box. :)
'We all must do the hard bits so when we get bit we know where to bite' :)
 
Darrell

to create a cool thermometer.

I'd like to see that, when you are done.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top