RECT Type

Windows specific questions.
Post Reply
Kcproductionz
Posts: 38
Joined: Jun 30, 2005 4:44

RECT Type

Post by Kcproductionz »

Im making a small little sprite library and Im using GetClientRect to get the client area of the window so I can stretch the background image to fit to it and I cant figure out what the RECT.x1's and RECT.y1's and such, Ive tried a lot of stuffs and cant figure it out =-\.
Last edited by Kcproductionz on Jul 26, 2005 16:58, edited 2 times in total.
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

Look in winbase.bi:

Code: Select all

Type RECT
  nLeft   As Integer
  nTop 	  As Integer
  nRight  As Integer
  nBottom As Integer
End Type
Kcproductionz
Posts: 38
Joined: Jun 30, 2005 4:44

Post by Kcproductionz »

Oh, I thought winbase.bi was already compiled.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Post by DrV »

Not sure what you mean by "compiled"; here's an example of using a RECT:

Code: Select all

#include "win/winbase.bi"

Dim my_rect as RECT

my_rect.nLeft = 5
my_rect.nTop = 10
my_rect.nRight = 20
my_rect.nBottom = 30
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

All structures are defined in the "headers" of the library. For FreeBASIC, these are the .bi files in \inc, or for the Windows API, \inc\win. Otherwise, your program couldn't use them. To the libraries, structures in memory are just a bunch of bytes: "RECT", and it's properties are nowhere to be found in the DLL files.

You don't need to worry about including winbase.bi (the other headers, such as kernel32.bi take care of this). But that's how the win-api headers defines one. Just check the header files if you need to know what's in any other structures.
fsw
Posts: 260
Joined: May 27, 2005 6:02

Post by fsw »

@Kcproductionz

Windows help file states that RECT is defined as:

Code: Select all

Type RECT
  Left   As Integer
  Top    As Integer
  Right  As Integer
  Bottom As Integer
End Type
but in freebasic's winbase.bi it's declared as:

Code: Select all

Type RECT
  nLeft   As Integer
  nTop    As Integer
  nRight  As Integer
  nBottom As Integer
End Type
So if something doesn't work as aspected, you have to look into the *.bi files and write your code as it's declared in the *.bi include files.
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

I wonder if it's possible to get the Windows CHM and replace the syntax-boxes with those from FreeBASIC's .bi files. It would be a chore - it would require a parser to get the right code examples, but it would definately be a big help.
Post Reply