msdn shows one of the parameters of the GetTextExtentPoint32 function as LPSIZE. When I try it, I get an "undefined symbol" error. What is the best way to handle this?
Thanks,
Try interpreting lpSize as a pointer to a SIZE structure.
yes - lpSize is not defined - you have to create the structure, and pass the pointer
typedef struct tagSIZE
{
LONG cx;
LONG cy;
} SIZE, *PSIZE, *LPSIZE;
The first problem with this definition is that SIZE is a MASM reserved word, so the structure was renamed to SIZEL. The second problem is that one of the members conflicts with the reserved word CX, so the members were renamed to simply x and y.
SIZEL STRUCT
x DWORD ?
y DWORD ?
SIZEL ENDS
And I assume that there is no LPSIZE or LPSIZEL defined because it's not actually needed, and as far as I know, given the limited type checking that MASM performs, it would provide no benefit.
;=========================================================================
include \masm32\include\masm32rt.inc
;=========================================================================
.data
sz SIZEL <>
str1 db "my other brother darryl",0
.code
;=========================================================================
start:
;=========================================================================
invoke GetDC, NULL
invoke GetTextExtentPoint32, eax, ADDR str1, SIZEOF str1, ADDR sz
print str$(sz.x),9
print str$(sz.y),13,10,13,10
inkey "Press any key to exit..."
exit
;=========================================================================
end start
That does it.
Thanks.