Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Middle Click title bar
#1
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.
An old blog on QM coding and automation.

The Macro Hook
#2
#Mh2
#3
awesome. thanks.
An old blog on QM coding and automation.

The Macro Hook
#4
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:


Code:
Copy      Help
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
pi
#5
I just found this function in my list, but don't remember whether it works well.

Function GetWindowTextWidth:
Code:
Copy      Help
;/
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
#6
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
Code:
Copy      Help
siz GetWindowTextWidth(hwnd)+60 ti.rcTitleBar.bottom-ti.rcTitleBar.top hwnd 0
pi
#7
GetTitleBarInfo, GetWinStyle, GetSystemMetrics, SystemParametersInfo, Acc.State, Acc.Location.
#8
thanks, i get the idea.

http://support.microsoft.com/?kbid=210603

SM_CXSIZE is one of my friends,
pi
#9
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.
pi
#10
Function EnumQmToolbars
Code:
Copy      Help
;/
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
Code:
Copy      Help
int hwndOwner=_hwndqm

ARRAY(int) a
int i n=EnumQmToolbars(a hwndOwner)
for i 0 n
,siz 8 8 a[i]


Forum Jump:


Users browsing this thread: 1 Guest(s)