News:

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

how to know information of a control?

Started by RHL, April 05, 2012, 05:51:48 AM

Previous topic - Next topic

RHL

I want to know as know the position of a control ( the X,Y coordinates ).
also I want know the height and widht properties
API to use?

dedndave

we usually use GetWindowRect
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519%28v=vs.85%29.aspx

it returns a RECT
        .DATA?

rc      RECT <>

        .CODE

        INVOKE  GetWindowRect,hWindow,offset rc
        mov     ecx,rc.right
        mov     edx,rc.bottom
        sub     ecx,rc.left
        sub     edx,rc.top

;ECX = width
;EDX = height


if it is the top window, the RECT values are screen coordinates
if it is a child window, the RECT values are client coordinates

you can use the function for all types of windows - buttons, etc
i don't think it works for menus, though

MichaelW

Another possibility is GetWindowInfo, although I don't recall ever testing it on a child window.

And for some purposes GetClientRect might be useful.
eschew obfuscation

RHL