Auto Detect Resolution

Blitz3D Forums/Blitz3D Programming/Auto Detect Resolution

EpicElrod(Posted 2015) [#1]
I want to make my game pretty. How do I make it auto-detect resolution? I don't like messing with menus and stuff when I'm playing, and others don't either. If you can share some code (Blitz3D, btw) that would be awesome. Thanks!


Flanker512(Posted 2015) [#2]
You can use user32.dll to detect the desktop resolution : http://www.blitzbasic.com/Community/posts.php?topic=46522


EpicElrod(Posted 2015) [#3]
Thanks.


EpicElrod(Posted 2015) [#4]
Hey, every time I use it, it says "Function "getsystemmetrics" Not found."
Why?


Brucey(Posted 2015) [#5]
Did you create a file named "user32.decls" inside your "userlibs" folder ?


EpicElrod(Posted 2015) [#6]
Yes I did. I followed everything exactly.


Rick Nasher(Posted 2015) [#7]
Hmm, tested it just now. Working perfectly fine on Blitz3d V1.106 (I didn't update to latest as I have FastExt and not bothered to try the fix yet until I get Windows 10 and break compatibility with it).

But my user32 file is like this(more stuff in it as you can see). Dunno if that's needed though. There are pretty large versions around if you browse these forums. Probably already clear, but here are some step-by-step instructions:

1) Create a notepad text file(disable wordwrap).
2) Copy the content from the box below into it.

*Note: Make sure you are showing extensions by disabling the Windows folder layout settings "Hide extensions for known file types" otherwise you'll end up with "user32.decls.text" , but the ".txt" bit won't show up as it's hidden. Then it won't work for Blitz doesn't read that as a decls file.

3) Save as: user32.decls
4) Copy the file to your Blitz3d userlibs folder, e.g: "C:\Program Files (x86)\Blitz3D\userlibs"


user32.decls



And a little test Blitz3d program:

Detect_Desktop_Res.bb