#persistent
*~$!F8:: ; Alt-F8
B=firefox
result:=Browser_RetrievePageName(B)
return
Browser_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)
hData:=DllCall("DdeClientTransaction","Uint",0,"Uint",0,"UPtr",hConv,"UPtr",hItem,"UInt",1,"Uint",0x20B0,"Uint",10000,"UPtrP",nResult)
sData := DllCall("DdeAccessData","Uint",hData,"Uint",0,"str")
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")
msgbox result %result% ; ergibt bei mir LEER : JETZT NICHT MEHR
return result
}
Das hier sollte funktionieren.
Der Fehler:
Wie bereits in der Ursprungstopic gesagt:
hServer := DllCall("DdeCreateStringHandleW","UPtr",idInst,"Str",%Browser%,"int",1200)
Keine %% um Browser da sonst der Inhalt der Variable firefox übergeben wird, un der ist 0.