ll_libload user, "user32.dll"
ll_getproc GetWindowText, "GetWindowTextA", user
ll_getproc GetForegroundWindow, "GetForegroundWindow", user
#module
#deffunc getactivehwnd val
mref h, 16
ll_callfnv GetForegroundWindow@
ll_ret h
return
#deffunc gettitle int
mref id, 0
mref stt, 64
mref rstr, 65
mref bmscr, 67
sdim s, 1024
if id = -1 { getactivehwnd i.1 } else { i = id + 96 : i.1 = bmscr.i }
prm = i.1, 0, 0
ll_getptr rstr : ll_ret prm.1
ll_getptr stt : ll_ret prm.2
ll_callfunc prm, 3, GetWindowText@
ll_ret i : stt = i
return
#global
mes "3秒後、アクティブなウィンドウのタイトルテキストを取得します"
wait 300
gettitle -1
mes "取得テキスト「" + refstr + "」"
mes "バイト数「" + stat + "」"
stop
|