Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Getting the URL of the Current Displayed Page in Netscape

Keywords: url netscape dllcall 

Question:

How do I extract the URL of the current displayed page in Netscape?

Answer:

This code extracts the current URL from a copy of Netscape. Tested on Netscape 2.0 and 3.0.

32 bit Version

dllname=strcat(DirWindows(1),"user32.dll")
user=dllLoad(dllname)
ns=dllHwnd("Netscape -")
n1=DLLCall(user, long:"GetWindow", long:ns, long:5)
n1=DLLCall(user, long:"GetWindow", long:n1, long:2)
n1=DLLCall(user, long:"GetWindow", long:n1, long:2)
n1=DLLCall(user, long:"GetWindow", long:n1, long:2)
n2=DLLCall(user, long:"GetWindow", long:n1, long:5)
n3=DLLCall(user, long:"GetWindow", long:n2, long:5)
bl=256 ; abritrary max len
buf=binaryAlloc(bl)
binaryEODset(buf,bl)

;The Folowing should be on ONE LINE
url=BinaryPeekStr(buf,0,DLLCall(user, long:"SendMessageA", long:n3,
long:13, long:bl, lpbinary:buf)) 
;END OF THE ONE LINE STUFF

dllFree(user) 
binaryFree(buf) 
Message("URL IS",url)
exit

16 bit version

user=dllLoad("user.exe")
ns=dllHwnd("Netscape -")
n1=DLLCall(user, word:"GetWindow", word:ns, word:5)
n1=DLLCall(user, word:"GetWindow", word:n1, word:2)
n1=DLLCall(user, word:"GetWindow", word:n1, word:2)
n1=DLLCall(user, word:"GetWindow", word:n1, word:2)
n2=DLLCall(user, word:"GetWindow", word:n1, word:5)
n3=DLLCall(user, word:"GetWindow", word:n2, word:5)
bl=256 ; abritrary max len
buf=binaryAlloc(bl)
binaryEODset(buf,bl)


; Following should ne on ONE line
url=BinaryPeekStr(buf,0,DLLCall(user, word:"SendMessage",word:n3, word:13,word:bl, lpbinary:buf)) 
; END of the ONE line

dllFree(user) 
binaryFree(buf) 
Message("URL IS",url)
exit

Article ID:   W13349
Filename:   Getting the URL of the Displayed Page.txt