Size of window border

Blitz3D Forums/Blitz3D Programming/Size of window border

Virtech(Posted 2009) [#1]
Hi

In conjunction with this taskbar functionality I need to get the metrics (sizes) of the different part of a window border around a b3d application. Would it be possible to get this data also trough the use of a decls?

Thanks.


BlitzSupport(Posted 2009) [#2]
Yep, use GetSystemMetrics. There's also SystemParametersInfo but it's a bit more complicated -- with GetSystemMetrics you just pass the value you want to retrieve and it returns it, eg. xborder = GetSystemMetrics (value).

I'll let you have a go yourself first, but if you get stuck just say!

Scroll to the bottom of that page and look at the grey Requirements box, which tells you which DLL the function is in. If a .decls file of that name doesn't exist in the Blitz3D\userlibs folder, create it, otherwise back up the existing one and edit it. It's just a plain text file with ".decls" extension. If you have to create it, use the DLL's name for the file (eg. for example.dll you create example.decls).

Follow the format in the Userlibs Specs document to add the function name -- you only need to look at the "Format of decls files" section. Once added, save the file and try calling the command from Blitz.

If it all looks right but Blitz says the function doesn't exist, try adding 'A' to the function name (as in the DLL there may be Unicode and Ascii versions of the function), eg. GetSomething% (details) becomes GetSomethingA% (details).

The constants you want to pass are probably SM_CXBORDER and SM_CYBORDER, or maybe SM_CXFIXEDFRAME and SM_CYFIXEDFRAME -- try both and see what you get. (Also look through the list to see if anything else sounds appropriate.) The docs page above helpfully tells you the values in this case, so just define the constants you need with these values (in your Blitz program, not in the .decls) before calling the function.

(In cases where constants aren't documented, just type const SM_CYFIXEDFRAME (for example) into Google and you'll usually find C source declaring them. Check a few results just to be sure they're correct.)

See how you get on anyway...


Virtech(Posted 2009) [#3]
Many thanks again for the great support. I think you provided me with enough info to get me going in the right direction. Should be a piece of cake :)


Zethrax(Posted 2009) [#4]
I have a codelib entry at http://www.blitzbasic.com/codearcs/codearcs.php?code=1071 which may be useful to you.


Virtech(Posted 2009) [#5]
Thanks Bill :) I found that codelib very helpful.