how can I get url from firefox and chrome?

For Chrome

First: get Chrome_WidgetWin_1 class handle

CHHwnd = FindWindowEx(0, 0, "Chrome_WidgetWin_1", vbNullString)

get it's child's handle

CHWorker = FindWindowEx(CHHwnd, 0, "Chrome_OmniboxView", vbNullString)

then get the URL text:

CHTextLenght = SendMessage(CHWorker, WM_GETTEXTLENGTH, CInt(0), CInt(0)) + 1  ' Get Length Of Text
CHtxtBuff = Space(CHTextLenght)
CHURL = SendMessage(CHWorker, WM_GETTEXT, CHTextLenght, CHtxtBuff)
CHtxtBuff = Replace(CHtxtBuff, Chr(0), "")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.