10-17-2016, 08:40 AM
Macro Macro16
when this code is loaded (function running in QM), all works flawlessly for what i need except i can't anymore type urls in chrome's url edit box....
if(getopt(nthreads)>1) ret ;;allow single instance
def WM_MYMESSAGE WM_APP+1000
int hwnd=TriggerWindow ;;if trigger
if(!hwnd) hwnd=win("* - Google Chrome" "Chrome_WidgetWin_1" "" 1) ;;if Run button
if(!hwnd) ret ;;no Chrome
int pid; if(!GetWindowThreadProcessId(hwnd &pid)) end ERR_FAILED 16 ;;hook only this Chrome process
type MyToolbarInteractData str'h
MyToolbarInteractData- x
int hh=SetWinEventHook(EVENT_OBJECT_NAMECHANGE EVENT_OBJECT_NAMECHANGE 0 &sub.Hook pid 0 WINEVENT_OUTOFCONTEXT)
if(!hh) end ERR_FAILED 16
cop- "$my qm$\chrome.txt" "$my qm$\chrome-backup.txt" FOF_ALLOWUNDO|FOF_NOCONFIRMMKDIR|FOF_NOERRORUI|FOF_SILENT|FOF_FILESONLY
opt waitmsg 1 ;;don't block Windows messages, else sub.Hook cannot be called
wait 0 WP hwnd ;;wait until Chrome process exits
UnhookWinEvent hh
;
#sub Hook v
function hHook event hwnd idObject idChild dwEventThread dwmsEventTime
if(!hwnd) ret
MyToolbarInteractData- x
;outw hwnd ;;debug
Acc a.FromEvent(hwnd idObject idChild)
str f
_s=a.Name
if(_s.beg("Barre d'adresse et de recherche"))
,int w1=win(" - Google Chrome" "Chrome_WidgetWin_1")
,Acc a1.Find(hwnd "TEXT" "Barre d'adresse et de recherche" "class=Chrome_WidgetWin_1[]xy=146 43" 0x1005)
,x.h=a1.Value
,if(empty(x.h)) ret
,if(strcmp(x.h "Barre d'adresse et de recherche")=0) ret
,if(x.h.beg("chrome-extension://klbibkeccnjlkjkiokjodocebajanakg/suspended.html#uri="))
,,2
,,a1.Find(hwnd "TEXT" "Barre d'adresse et de recherche" "class=Chrome_WidgetWin_1[]xy=146 43" 0x1005)
,,x.h=a1.Value
,,SendMessage win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 0 &x.h
,SendMessage win("CHROMEBAR" "QM_toolbar") WM_MYMESSAGE 0 &x.h
err+ ;;Acc functions throw error when closing Chrome
when this code is loaded (function running in QM), all works flawlessly for what i need except i can't anymore type urls in chrome's url edit box....