WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with MSIE
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Grab Url of Active Window


title =  "Active URL Grabber"
BoxOpen(title,"Initializing")
IntControl(54,title,1,0,0)
url = ""
While @true
	activehndl = DllHwnd(WinGetActive())
	oShellApp = ObjectOpen("Shell.Application");
	oWindows = oShellApp.Windows()
	cnt = oWindows.Count
	url = ""
	For item = 0 to cnt-1 
	   oWin = oWindows.Item(item);
		ErrorMode(@off)
	   handle = oWin.HWND
		ErrorMode(@cancel)
		if handle == 0 then continue 
		if activehndl == handle
			url = oWin.locationURL
		Endif 
	   ObjectClose(oWin)
	Next
	BoxText(url)
	ObjectClose(oWindows)
	ObjectClose(oShellApp)
	TimeDelay(2)
Endwhile
exit

Article ID:   W16121
File Created: 2004:03:30:15:42:56
Last Updated: 2004:03:30:15:42:56