I need to find the width an height to my device context.
Here's a link I was following...http://www.codeguru.com/forum/archive/index.php/t-119164.html (http://www.codeguru.com/forum/archive/index.php/t-119164.html)
Edit. This works :)
' Make a new device context exactly like the one given to us:
' (we need it to do our drawing operations in memory)
DC = _CreateCompatibleDC(TargetDC)
' Figure out the width and height of this thing:
int hBmp = _GetCurrentObject(TargetDC, OBJ_BITMAP)
BITMAP bmp
_GetObject(hBmp, Len(bmp), bmp)
Width = bmp.bmWidth
Height = bmp.bmHeight
' ------------------------------------------------------ '
Quote from: JosephE on June 03, 2010, 10:29:21 AM
However, eb doesn't seem to have a & operator for referencing a variable's address.
yes it does and I use it all the time
Quote from: JosephE on June 03, 2010, 10:29:21 AM
_GetObject(hBmp, & bmp, Len(bmp))
Proper usage would be
&bmp
and not
& bmp
LarryMc
I looked up the GETOBJ function and saw you had your parameter order wrong.
After you got the parameter order correct it worked without a &.
That's because bmp is a UDT structure(BITMAP) and IWB passes strings and UDTs byref (address) by default.
Numeric variables are passed by value by default but there are times when you need to pass them byref so you prepend the &.
I personally do that with numeric values like passing a rgb composite color and also pass &r,&g,&b so I get the 3 individual colors back from a subrotine.
LarryMc
Thank you larry! I'm glad to find that out! :)
Very useful to know since I'm embarking on a new EB project right now. I swear I couldn't find the & address operator in the manual, except when passing the address of a sub.
It's kind of obscure. ;)
From the
Languages/Operators section of the help file:
QuoteSome symbols are reused for other purposes depending on the context of the operator. For example the & symbol is used as the bit wise AND operator and also as the Address Of operator
LarryMc
Wow. I read that like 5 times and still didn't notice that ::)...thanks! :)
It gets worse as you get older. trust me. I know! ;)
LarryMc