Change Resolution

BlitzPlus Forums/BlitzPlus Programming/Change Resolution

Walter(Posted 2004) [#1]
Is it possible to change the resolution of windows (the desktop)?

For example, My program is in 800x600 window but I want it on a 1024x768 screen resolution.


Eikon(Posted 2004) [#2]
The function is user32's ChangeDisplaySettings. You'd have a hell of a time getting this to work with a userlib, so a custom DLL would be best if you know what you're doing.

Most people don't like their desktop resolution to be messed with. It screws up icon alignment, and I just don't think it's worth the trouble. Good luck though.


Walter(Posted 2004) [#3]
I know that's problem but that only when you change the desktop to a lower resolution. If you want your game in 1024x768 for fine graphics and the desktop is in 800x600 (or 640x480 !) icons will not be screwed up.
If the desktop is already in 1024x768 or higher, the resolutio n must not be changed.
What do you mean by a "custom" DLL?
Thanks


Eikon(Posted 2004) [#4]
Yes, you're right about that, it only affects the icons when you lower it.

By custom I meant you would need to write your own DLL in C that would call ChangeDisplaySettings for you. It would have width/height params that you pass from blitz. This way you have C/C++ do the work that a blitz userlib cannot. It might still be possible to do this with a userlib, but I have my doubts.

Sorry I can't be of more assistance. Someone should be by to help you soon enough


Eikon(Posted 2004) [#5]
OK Walter. I decided since this was a real toughie I'd go ahead and write the DLL for you. I take no responsiblity for any damage this may do to anyone's monitor :)

Download changeres.dll
; Required Userlib
; .lib "changeres.dll"
; ChangeRes%()

Graphics 640, 320, 16, 2

; Calling ChangeRes
ChangeRes

; This function checks to see if the users desktop width is less than 1024.
; If it is, the desktop is set to 1024x768. The user will receieve an error
; message if their monitor doesn't support this mode. Their current bit depth
; will be preserved, but the refresh rate will not. A default of 60hz will most
; likely be used. This is because I do not feel confident fiddling with a 
; monitor's refresh rate.

WaitKey()
Let me know how she flows.


Walter(Posted 2004) [#6]
Yo man! :)
Thanks for your work!

Don't be afraid for my monitor, it did the war and will never die by simply changing the screen resolution.

Your code will be also useful to other users ;)


MSW(Posted 2004) [#7]

Most people don't like their desktop resolution to be messed with. It screws up icon alignment, and I just don't think it's worth the trouble. Good luck though.



Additionaly some people have LCD moniters and other techy stuff with fixed max screen resolutions....more then icon alignment can get messed up if you try to force a larger resolution...

And if you have an 800 by 600 window...why not just check to see if such a resolution is available in fullscreen, then ask if the user wants to go that route?

You can then use one of the many available Blitz3D basied GUI systems as a baseis for your own windows like user control system if you still need such features in fullscreen.


Rob Farley(Posted 2004) [#8]
Or just use a getsystemmetrics decl, find out what res their desktop is in and tell them to change it accordingly if necessary. ie, this app requires your computer to be in 1024x768 or higher, do you want me to change this for you? Yes/No. (No quits.)