Posts: 1,769
Threads: 410
Joined: Feb 2003
is there a way to trigger a macro when a mouse middle-click occurs on any window tittle bar?
i'd like to "roll-up" the window when that happens.
thanks.
Posts: 12,140
Threads: 142
Joined: Dec 2002
Posts: 1,769
Threads: 410
Joined: Feb 2003
Posts: 1,271
Threads: 399
Joined: Mar 2003
how do i get info about the font settings of my current running xp theme ?
like: font name and size applied to window titlebar, button size, etc ?
my idea is to rollup a window and size it to buttons+wintext.
my current script is far from perfect:
int hwnd=win(mouse)
def CCHILDREN_TITLEBAR 5
type TITLEBARINFO cbSize RECT'rcTitleBar rgstate[CCHILDREN_TITLEBAR+1]
dll user32 #GetTitleBarInfo hwnd TITLEBARINFO*pti
RECT r; GetWindowRect hwnd &r ;;save
TITLEBARINFO ti.cbSize=sizeof(TITLEBARINFO)
GetTitleBarInfo hwnd &ti
str value
typelib GflAx {059321F1-207A-47A7-93A1-29CDF876FDD3} 1.0
GflAx.GflAx g._create
g.FontSize=8
int width=g.GetTextWidth(_s.getwintext(hwnd))+140
_s=hwnd
int x y rw rh; GetWinXY hwnd x y rw rh
str xy.from(rw "-" rh)
rget(value _s "rollup" HKEY_CURRENT_USER)
str w.gett(value 0 "-");str h.gett(value 1 "-")
if (len(value)=0)
,rset(xy _s "rollup" 0 REG_SZ)
,siz width ti.rcTitleBar.bottom-ti.rcTitleBar.top hwnd 0
else
,rset(xy _s "rollup" 0 -1)
,siz val(w) val(h) hwnd ;;restore
Posts: 12,140
Threads: 142
Joined: Dec 2002
I just found this function in my list, but don't remember whether it works well.
Function GetWindowTextWidth:
;/
function# hwnd
dll gdi32 #GetTextExtentPoint32 hDC $lpsz cbString SIZE*lpSize
int st=GetWindowLong(hwnd GWL_STYLE)
if(st&WS_CAPTION != WS_CAPTION) ret
str s.getwintext(hwnd); if(!s.len) ret
int dc=GetWindowDC(hwnd)
SIZE si
int r=GetTextExtentPoint32(dc s s.len &si)
ReleaseDC(hwnd dc)
if(r) ret si.cx
Posts: 1,271
Threads: 399
Joined: Mar 2003
well at least its better then using GflAx.
but how to get the icon size of min/max/close ?
i mean i can live with the current result
siz GetWindowTextWidth(hwnd)+60 ti.rcTitleBar.bottom-ti.rcTitleBar.top hwnd 0
Posts: 12,140
Threads: 142
Joined: Dec 2002
GetTitleBarInfo, GetWinStyle, GetSystemMetrics, SystemParametersInfo, Acc.State, Acc.Location.
Posts: 1,271
Threads: 399
Joined: Mar 2003
thanks, i get the idea.
http://support.microsoft.com/?kbid=210603
SM_CXSIZE is one of my friends,
Posts: 1,271
Threads: 399
Joined: Mar 2003
is there a simple way to get all attached toolbars from a hwnd ?
my qm editor has 3 toolbars,
because i need to hide them on rollup.
and (Doh!) show on reverse rollup.
Posts: 12,140
Threads: 142
Joined: Dec 2002
Function EnumQmToolbars
;/
function# ARRAY(int)&hwnds [hwndOwner]
dll user32 #FindWindowEx hWnd1 hWnd2 $lpsz1 $lpsz2
hwnds=0
int h
rep
,h=FindWindowEx(0 h "QM_Toolbar" 0); if(!h) break
,if(!hwndOwner or GetWindow(h GW_OWNER)=hwndOwner) hwnds[hwnds.redim(-1)]=h
ret hwnds.len
Example
int hwndOwner=_hwndqm
ARRAY(int) a
int i n=EnumQmToolbars(a hwndOwner)
for i 0 n
,siz 8 8 a[i]