Code: Select all
browser:="Firefox"
msgbox, % FF_RetrievePageName(browser)
return
FF_RetrievePageName(browser)
{
DllCall("DdeInitializeW","UPtrP",idInst,"Uint",0,"Uint",0,"Uint",0)
; CP_WINANSI = 1004 CP_WINUNICODE = 1200
CP_WIN:=A_IsUnicode?1200:1004
hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str",browser,"int",cp_win)
hTopic := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","WWW_GetWindowInfo","int",cp_win)
hItem := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str","0xFFFFFFFF","int",cp_win)
hConv := DllCall("DdeConnect","UPtr",idInst,"UPtr",hServer,"UPtr",hTopic,"Uint",0)
; CF_TEXT = 1 CF_UNICODETEXT = 13
CF_TEXT :=1
hData := DllCall("DdeClientTransaction","Uint",0,"Uint",0,"UPtr",hConv,"UPtr",hItem,"UInt", CF_TEXT,"Uint",0x20B0,"Uint",10000,"UPtrP",nResult)
; seems to fail at hData
sData := DllCall("DdeAccessData","Uint",hData,"Uint",0,"str")
msgbox, % hserver " " hTopic " " hItem " " hConv " " hData " sData" sData
DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hServer)
DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hTopic)
DllCall("DdeFreeStringHandle","UPtr",idInst,"UPtr",hItem)
DllCall("DdeUnaccessData","UPtr",hData)
DllCall("DdeFreeDataHandle","UPtr",hData)
DllCall("DdeDisconnect","UPtr",hConv)
DllCall("DdeUninitialize","UPtr",idInst)
result:=StrGet(&sData,"cp0")
return result
}