News:

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

how to call GetTitleBarInfo??

Started by jtqh1992, July 29, 2009, 02:34:09 PM

Previous topic - Next topic

jtqh1992

Hey all,

I would like to be able to invoke GetTitleBarInfo to grab the cords of the title bar.

Can anyone share their codes for me to reference with?

Thanks,
-Joel

dedndave

#1
i have never used this function, but i thought i would try it out
i see the windows.inc file does not have that structure
that's the first one i have found - lol
at any rate, i tried a simple program using console mode
it returns error 87 - invalid parameter
i don't know why - it may not like the handle from GetConsoleWindow that i passed to it

EDIT - i replaced the struct definition as per qWord - he fixed it
also, notice that TBinfo.cbSize must be set prior to the call
if you want to use it in a gui app, i think GetDesktopWindow will return the handle you want

        INCLUDE \masm32\include\masm32rt.inc

TITLEBARINFO STRUCT
  cbSize     dd   ?
  rcTitleBar RECT <>
  rgstate    dd   (CCHILDREN_TITLEBAR+1) dup(?)
TITLEBARINFO ENDS

        .DATA?

hWnd         dd   ?

TBinfo TITLEBARINFO <>
; cbSize     dd   ?
; rcTitleBar RECT <>
;   left     dd   ?
;   top      dd   ?
;   right    dd   ?
;   bottom   dd   ?
; rgstate    dd   (CCHILDREN_TITLEBAR+1) dup(?)

        .CODE

_main   PROC

        INVOKE  GetConsoleWindow
        mov     hWnd,eax

        mov dword ptr TBinfo.cbSize,sizeof TBinfo
        INVOKE  GetTitleBarInfo,
                hWnd,
                ADDR TBinfo
        or      eax,eax
        jnz     tbinf1

        INVOKE  GetLastError
        push    eax
        print   chr$('Error: ')
        pop     eax
        print   uhex$(eax),13,10,13,10
        jmp     tbinf2

tbinf1: print   chr$('  Left: ')
        print   uhex$(TBinfo.rcTitleBar.left),13,10

        print   chr$('   Top: ')
        print   uhex$(TBinfo.rcTitleBar.top),13,10

        print   chr$(' Right: ')
        print   uhex$(TBinfo.rcTitleBar.right),13,10

        print   chr$('Bottom: ')
        print   uhex$(TBinfo.rcTitleBar.bottom),13,10,13,10

tbinf2: inkey   "Press any key to exit"
        exit

_main   ENDP

        END     _main

qWord

with this definition of TITLEBARINFO it works:

TITLEBARINFO struct
cbSize DWORD ?
rcTitleBar RECT <>
rgstate DWORD (CCHILDREN_TITLEBAR+1) dup (?)
TITLEBARINFO ends


regards, qWord
FPU in a trice: SmplMath
It's that simple!

dedndave

thanks qWord
i saw that "CCHILDREN_TITLEBAR+1" and thought it was some C thing - lol

jtqh1992

Thanks qWord and dedndave for your help! It has compiled smoothly and I'm trying to see if it works. Again, thanks for your time I really appreciated it