Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to use mouse event..
#4
This is an alternative "created window" trigger that can be used in exe. You need to edit something.

Macro
Code:
Copy      Help
;This is an example.

mac "WE_CreatedWindowInstall" ;;launch "created window" triggers in new thread

;do other things ...

Function WE_CreatedWindowInstall
Code:
Copy      Help
function [off]

;Installs/uninstalls hooks that will call WE_CreatedWindowProc whenever an object is created.
;This function does not need to be modified.


int-- hook
if(off) if(hook) UnhookWinEvent(hook); hook=0
else
,if(getopt(nthreads)>1) mes "Already running. If in QM, use Threads dialog to end thread. If in exe, thread will end automatically." "" "i"; ret
,hook=SetWinEventHook(EVENT_OBJECT_CREATE EVENT_OBJECT_CREATE 0 &WE_CreatedWindowProc 0 0 WINEVENT_OUTOFCONTEXT)
,atend WE_CreatedWindowInstall 1
,opt waitmsg 1
,wait -1

Function WE_CreatedWindowProc
Code:
Copy      Help
;/WE_Main
function hhook event hwnd idObject idChild dwEventThread dwmsEventTime
if(!hwnd or idObject or idChild or GetWindowLong(hwnd GWL_STYLE)&WS_CHILD) ret

;This function is called whenever a window (hwnd) is created. Edit it.
;Must return as soon as possible. Must not execute any code that would
;interact with applications (instead use mac to start other macros).


;This code only shows what window is created
str sc.getwinclass(hwnd) st.getwintext(hwnd)
out "class=%s, text=%s" sc st

;;To filter windows and launch macros, here you can use code like this
;if(wintest(hwnd "window text" "window class" ...))

,;mac "some macro"
;else if(wintest(hwnd "window text" "window class" ...))

,;mac "another macro"
;...


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)