contents   index   previous   next



SElib.subclassWindow(hWnd, windowFunction,



hWnd - a number, the handle of an existing window to subclass.


windowFunction - an identifier, the function that is called whenever Windows sends a message to this window. The parameter windowFunction is the same as for SElib.makeWindow().


utilityVar - any variable that a scripter chooses. This variable is passed to the windowFunction when it receives a Windows message. The parameter utilityVar is the same as for SElib.makeWindow().



boolean - true on success, else false if hWnd is invalid, was created with SElib.makeWindow(), or is already subclassed.



For Win32 and Win16


This method hooks the specified windowFunction into the message loop for a window such that the function is called before the window's default or previously-defined function.


The parameter hWnd is the window handle of an already existing window to subclass.


The parameter windowFunction is the same as in the SElib.makeWindow() method. Note that, as in the SElib.makeWindow() method, if this method returns a value, then the default or subclassed function is not called. If this method returns no value, the call is passed on to the previous function. This method may be used to subclass any Window that is not already being managed by a windowFunction for this ScriptEase instance. If a window was created with SElib.makeWindow() or is already subclassed then this method fails.


Note that this method may be used only once, with the window handle returned by Screen.handle(). If you want to subclass the main ScriptEase window, it is best to open another instance of ScriptEase and subclass it rather than to subclass the instance that is powering your script. Although it is possible to subclass that window, if you try to do anything with it, you will likely get caught in an infinite loop and hang. To undo the window subclassing or remove a WindowFunction from the message loop, use SElib.breakWindow().


A WindowFunction may modify UtilityVar.


In your function that handles messages for another process, certain limits are set as to what you can do with system resources. For example, an open file handle is invalid while processing a message for another program, because Windows maps file handles into a table for programs. To work around this problem, you may send a message to one of your ScriptEase windows to handle the processing. This action switches Windows' tables to your program while handling that SendMessage.



SElib.makeWindow(), Window object in winobj.jsh