Skip to content

waitControl() and waitWindow()

Matyáš Levíček edited this page Aug 17, 2023 · 2 revisions

Wait for control/window change

When called, the callback is executed and than a loop starts to wait for the focus window control to change. At maximum, we wait for the timeout to pass, than return.

This is for example useful when using keyboard shortcuts to focus the search box in some programs, and only proceed when its in focus. No need to set arbitrary delays.

Usage

waitControl(int hwnd, int timeout, function callback) ;

waitWindow(int timeout, function callback) ;

  • hwnd - pass a valid Handle to WiNDow in which to monitor for changes (can be obtained by WinGetID())
  • timeout - in milliseconds, how long to wait before timing out and returning (essentially maximum wait period)
  • callback - pass a function or a FAF
Clone this wiki locally