News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

TYPE problem

Started by peaslee, November 10, 2010, 06:33:58 PM

Previous topic - Next topic

peaslee

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,
Bruce Peaslee
"Reality is a crutch for those who can't do drugs."

jj2007

Try interpreting lpSize as a pointer to a SIZE structure.

dedndave

yes - lpSize is not defined - you have to create the structure, and pass the pointer

MichaelW


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

eschew obfuscation

peaslee

Bruce Peaslee
"Reality is a crutch for those who can't do drugs."