01-29-2004, 09:02 PM
If you are writing a filter function, please read "Filter function examples" in QM help (Example1).
Program: if it is for trigger, use scope rather than evaluate it in filter function. If it is in a macro, use wintest.
You should use wintest rather than win. Function win searches for specified window and returns window handle, so, if such window exists, the code allows macro to run. Function wintest examines window (first argument is window handle) and returns 1 if window's properties match other arguments. This handle, for example, can be f.hwnd (in filter function) or win() (active window).
QM status bar shows id for control (child window) under mouse pointer. Top-level window does not have id. You can, for example, search for window-specific control. Use function id or child. For example, following filter function allows trigger if window contains a child with text "Text" and class "Static":
Following filter function allows trigger if window contains a child with id 2:
Of course, function child is better in this case, because many windows, even in the same app, can have a control with id 2.
Note: in current QM version, there is one bug in filter functions: for mouse-click triggers, it can give root owner window in f.hwnd. Use win() instead of f.hwnd.
Program: if it is for trigger, use scope rather than evaluate it in filter function. If it is in a macro, use wintest.
You should use wintest rather than win. Function win searches for specified window and returns window handle, so, if such window exists, the code allows macro to run. Function wintest examines window (first argument is window handle) and returns 1 if window's properties match other arguments. This handle, for example, can be f.hwnd (in filter function) or win() (active window).
QM status bar shows id for control (child window) under mouse pointer. Top-level window does not have id. You can, for example, search for window-specific control. Use function id or child. For example, following filter function allows trigger if window contains a child with text "Text" and class "Static":
Following filter function allows trigger if window contains a child with id 2:
Of course, function child is better in this case, because many windows, even in the same app, can have a control with id 2.
Note: in current QM version, there is one bug in filter functions: for mouse-click triggers, it can give root owner window in f.hwnd. Use win() instead of f.hwnd.
