Hi,
I've seen this somewhere but can't find it now.
How do I get the caption / title of the active window?
I think you need to use the GetWindowTextA function - does anyone have an example of how to do this?
Example: program A and program B are running, if you click on program A how do you get the title / caption of program A?
Thanks,
Andy.
			
			
			
				DECLARE extern GetForegroundWindow(),INT
DECLARE extern GetWindowTextA(hwnd:INT, lpSTRING:STRING, cch:INT),INT
window w1
OPENWINDOW w1,0,0,350,80,@MINBOX|@MAXBOX|@SIZE,0,"Simple Window",&main
CONTROL w1,@static,"",5,5,340,20,0, 1
starttimer w1,500
WAITUNTIL  iswindowclosed(w1)
END
SUB main(),int
    select @MESSAGE 
		case @IDCLOSEWINDOW
			stoptimer w1
        CLOSEWINDOW w1
		case @IDTIMER
			int hwnd=GetForegroundWindow()
			string caption
			GetWindowTextA(hwnd,caption,255)
			setcontroltext w1,1,caption
    ENDSELECT
RETURN
ENDSUB
			
			
			
				Thanks Larry,
That's perfect!
Andy.
 :)