Ekas Software Windows Script Host Control for Delphi Help
TekWSHControl
Hierarchy, Members, Properties, Methods, Events, Unit: ekWSHmain
ekWSHControl component class.
TekWSHControl = class(TWSHScriptControl)
Unit
ekWSHmain
Description
Allows to share application objects with Windows Scripting Host without implementing OLE server. Adds IDispatch realization to VCL objects so any descendant of TPersistent can be used within Windows Scripting Host engine. See Overview section of this help to get more common information about ekWSHControl.

TekWSHControl.OnError
TekWSHControl, See Also
property OnError;
Description
Occurs when error is occured during script execution. To obtaing error information, you have to analize TekWSHControl.ScriptError property in handler for this event

TekWSHControl.OnTimeout
TekWSHControl, See Also
Occurs if timeout is exeeded but script execution is not still finished.
property OnTimeout;

TekWSHControl.SafeSubset
TekWSHControl
Specifies access rights of script.
property SafeSubset: WordBool;
Description
When set to True, prevents access to selected objects and procedures that can compromise an application’s security.
Notes
For additional info see IScriptControl.UseSafeSubset info in related MSDN topics.

TekWSHControl.ScriptAllowUI
TekWSHControl
Specifies user interface elements accessibility within script.
property ScriptAllowUI: WordBool;
Description
When set to True, means that the script program can display user interface (UI) elements such as a MsgBox.
Notes
For additional info see IScriptControl.AllowUI info in related MSDN topics.

TekWSHControl.ScriptError
TekWSHControl
Returns an Error object containing detailed information about the last error that occurred.
property ScriptError: IScriptError;
Notes
For additional information see IScriptError interface description in related MSDN topics.

TekWSHControl.ScriptLng
TekWSHControl
Specifies script language which interpreter will be used by script engine.
property ScriptLng: TekWSHLanguages;
Description
Only VBScript and JScript ship with MS Windows by default, other scripting languages engines must be installed additionally.
Notes
For additional info see IScriptControl.Language info in related MSDN topics.

TekWSHControl.ScriptTimeout
TekWSHControl
Specifies the maximum number of milliseconds the script will run before an error will be generated.
property ScriptTimeout: integer;
Description
If script does not finishes within this time interval, error has been generated.

Set ScriptTimeout to -1 to let the script run unlimited time without error generating.

Notes
For additional info see IScriptControl.TimeOut info in related MSDN topics.

TekWSHControl.SitehWnd
TekWSHControl
Contains a reference to a hWnd that will be used to display GUIs.
property SitehWnd;
Notes
For additional info see IScriptControl.SitehWnd info in related MSDN topics.

TekWSHControl.State
TekWSHControl
Describes how events of objects added with the AddObject method will be handled.
property State;
Notes
For additional info see IScriptControl.State info in related MSDN topics.

TekWSHControl._About
TekWSHControl
Shows "About" dialog box.
class procedure _About;

TekWSHControl.AddCode
TekWSHControl
Adds code to script control.
procedure AddCode(const Code: WideString); override;
Description
Call this method to add new code to script control.
Notes
Script runs immediatelly after adding if there is any statements in code outside (before) procedures declarations. Procedures declared in added code can be called from such statements or directly from application using TekWSHControl.RunProc function

TekWSHControl.Create
TekWSHControl
Creates an instance of TekWSHControl.
constructor Create(AOwner: TComponent); override;
Description
Call Create to construct and initialize an instance of TekWSHControl. When overriding Create, always call the inherited Create method first, then proceed with the control's initialization. Remember to specify the override directive when overriding the Create method.
Notes
If constructor allocates resources or memory, also override the destructor to free those resources.

TekWSHControl.Destroy
TekWSHControl
Destroys an instance of TekWSHControl.
destructor Destroy; override;
Description
Do not call Destroy directly in an application. Instead, call Free. When declaring a Destroy method in a descendant control type, always add the override directive to the declaration and call the inherited Destroy as the last statement in the redeclared method.
Notes
Override Destroy to free any memory or resources allocated in the Create method.

TekWSHControl.Eval
TekWSHControl
Evaluates an expression.
function Eval(const Expression: WideString): OleVariant; override;
Return Value
Expression result
Description
Call this method to evaluate expression written in script language (defined by TekWSHControl.ScriptLng property).

TekWSHControl.ExecuteStatement
TekWSHControl
Executes a single statement.
procedure ExecuteStatement(const Statement: WideString); override;
Description
Call this method to execute a single statement written in script language (defined by TekWSHControl.ScriptLng property).
Notes
You can operate with any members which are added to script or defined in script code.

TekWSHControl.GetOleObject
TekWSHControl
Returns interface which represents given object and can be used in script
function GetOleObject(AObject: TPersistent): OleVariant;
Notes
Useful when passing object parameters to script procedures/functions

TekWSHControl.GetProxy
TekWSHControl
function GetProxy(AOwner: TPersistent): IDispatch;
Description
Creates representation object (with IDispatch realized) for VCL object passed as AOwner and adds it to internal proxy list. Returned interface can be used within script environment.
Notes
This method is implemented and used internally, you don't need to obviously implement or use it in your source code. But you may need to call it obviously in case of writing your custom descendant from its methods.

TekWSHControl.OnActivateHandler
TekWSHControl
procedure OnActivateHandler(Sender: TObject);
Description
Routes OnActivate event handling to script procedure named "<SenderName>_OnActivate". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnActivate:= ekWSHControl1.OnActivateHandler": Form1.OnActivate handling will be routed to "Form1_OnActivate()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnActivateHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnCanResizeHandler
TekWSHControl
procedure OnCanResizeHandler(Sender: TObject; var NewWidth: integer; var NewHeight: integer; var Resize: Boolean);
Description
Routes <Controls unit>OnCanResize event handling to script procedure named "<SenderName>_OnCanResize". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnCanResize:= ekWSHControl1.OnCanResizeHandler": Panel1.OnCanResize handling will be routed to "Panel1_OnCanResize()" if such procedure exists in the script)

NewWidth, NewHeight and Resize parameters of TCanResizeEvent are incapsulated in TCanResizeEventArgs class. OnCanResizeHandler procedure creates TCanResizeEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Param2.NewWidth" or "Param2.Resize"

Notes
This router works only for Controls.TCanResizeEvent or similar events which require similar parameters

If you will assign OnCanResizeHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnChangeHandler
TekWSHControl
procedure OnChangeHandler(Sender: TObject);
Description
Routes OnChange event handling to script procedure named "<SenderName>_OnChange". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Edit1.OnChange:= ekWSHControl1.OnChangeHandler": MyCanvas.OnChanging handling will be routed to "Edit1_OnChange()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnChangeHandler to another kind of events then unhandled "Access violation" exception mayl be raised due to stack crash


TekWSHControl.OnChangingHandler
TekWSHControl
procedure OnChangingHandler(Sender: TObject);
Description
Routes OnChanging event handling to script procedure named "<SenderName>_OnChanging". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "MyCanvas.OnChanging:= ekWSHControl1.OnChangingHandler": MyCanvas.OnChanging handling will be routed to "MyCanvas_OnChanging()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnChangingHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnClickHandler
TekWSHControl
procedure OnClickHandler(Sender: TObject);
Description
Routes OnClick event handling to script procedure named "<SenderName>_OnClick". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Panel1.OnClick:= ekWSHControl1.OnClickHandler": Panel1.OnClick handling will be routed to "Panel1_OnClick()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnClickHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnCloseHandler
TekWSHControl
procedure OnCloseHandler(Sender: TObject; var Action: TCloseAction);
Description
Routes <Forms unit>OnClose event handling to script procedure named "<SenderName>_OnClose". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Form1.OnClose:= ekWSHControl1.OnCloseHandler": Form1.OnClose handling will be routed to "Form1_OnClose()" if such procedure exists in the script)

Action parameter of Forms.TCloseEvent is incapsulated in TCloseEventArgs class. OnCloseHandler procedure creates TCloseEventArgs instance, fills it with passed value and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Param2.Action".

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will close form without changing Action value, Form1_OnClose_Args.Action will be represented in script as string "caHide" (default value for Action)

This router works only for TCloseEvent or similar events wich require similar parameters

If you will assign OnCloseHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnCloseQueryHandler
TekWSHControl
procedure OnCloseQueryHandler(Sender: TObject; var CanClose: Boolean);
Description
Routes <Forms unit>OnCloseQuery event handling to script procedure named "<SenderName>_OnCloseQuery". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Form1.OnCloseQuery:= ekWSHControl1.OnCloseQueryHandler": Form1.OnCloseQuery handling will be routed to "Form1_OnCloseQuery()" if such procedure exists in the script)

CanClose parameter of TCloseQueryEvent is incapsulated in TCloseQueryEventArgs class. OnCloseQueryHandler procedure creates TCloseQueryEventArgs instance, fills it with passed value and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.CanClose".

Notes
This router works only for Forms.TCloseQueryEvent or similar events which require similar parameters

If you will assign OnCloseQueryHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnConstrainedResizeHandler
TekWSHControl
procedure OnConstrainedResizeHandler(Sender: TObject; var MinWidth: integer; var MinHeight: integer; var MaxWidth: integer; var MaxHeight: integer);
Description
Routes OnConstrainedResize event handling to script procedure named "<SenderName>_OnConstrainedResize". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnConstrainedResize:= ekWSHControl1.OnConstrainedResizeHandler": Panel1.OnConstrainedResize handling will be routed to "Panel1_OnConstrainedResize()" if such procedure exists in the script)

MinWidth, MinHeight, MaxWidth and MaxHeight parameters of TConstrainedResizeEvent are incapsulated in TConstrainedResizeEventArgs class. OnConstrainedResizeHandler procedure creates TConstrainedResizeEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Param2.MinWidth" or "Param2.MaxHeight"

Notes
This router works only for TConstrainedResizeEvent or similar events which require similar parameters.

If you will assign OnConstrainedResizeHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnContextPopupHandler
TekWSHControl
procedure OnContextPopupHandler(Sender: TObject; MousePos: TPoint; var Handled: boolean);
Description
Routes OnContextPopup event handling to script procedure named "<SenderName>_OnContextPopup". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnContextPopup:= ekWSHControl1.OnContextPopupHandler": Panel1.OnContextPopup handling will be routed to "Panel1_OnContextPopup()" if such procedure exists in the script)

MousePos and Handled parameters of TContextPopupEvent are incapsulated in TContextPopupEventArgs class. OnContextPopupHandler procedure creates TContextPopupEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.Handled", "Params.MousePos_X" and "Params.MousePos_Y".

Notes
This router works only for TContextPopupEvent or similar events which require similar parameters.

If you will assign OnContextPopupHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnCreateHandler
TekWSHControl
procedure OnCreateHandler(Sender: TObject);
Description
Routes OnCreate event handling to script procedure named "<SenderName>_OnCreate". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnCreate:= ekWSHControl1.OnCreateHandler": Form1.OnCreate handling will be routed to "Form1_OnCreate()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnCreateHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnDblClickHandler
TekWSHControl
procedure OnDblClickHandler(Sender: TObject);
Description
Routes OnDblClick event handling to script procedure named "<SenderName>_OnDblClick". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Panel1.OnDblClick:= ekWSHControl1.OnDblClickHandler": Panel1.OnDblClick handling will be routed to "Panel1_OnDblClick()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnDblClickHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnDeactivateHandler
TekWSHControl
procedure OnDeactivateHandler(Sender: TObject);
Description
Routes OnDeactivate event handling to script procedure named "<SenderName>_OnDeactivate". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnDeactivate:= ekWSHControl1.OnDeactivateHandler": Form1.OnDeactivate handling will be routed to "Form1_OnDeactivate()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnDeactivateHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnDestroyHandler
TekWSHControl
procedure OnDestroyHandler(Sender: TObject);
Description
Routes OnDestroy event handling to script procedure named "<SenderName>_OnDestroy". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnDestroy:= ekWSHControl1.OnDestroyHandler": Form1.OnDestroy handling will be routed to "Form1_OnDestroy()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnDestroyHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnEnterHandler
TekWSHControl
procedure OnEnterHandler(Sender: TObject);
Description
Routes OnEnter event handling to script procedure named "<SenderName>_OnEnter". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Edit1.OnEnter:= ekWSHControl1.OnEnterHandler": Edit1.OnEnter handling will be routed to "Edit1_OnEnter()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnEnterHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnExecuteHandler
TekWSHControl
procedure OnExecuteHandler(Sender: TObject);
Description
Routes OnExecute event handling to script procedure named "<SenderName>_OnExecute". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Action1.OnExecute:= ekWSHControl1.OnExecuteHandler": Action1.OnExecute handling will be routed to "Action1_OnExecute()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnExecuteHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnExitHandler
TekWSHControl
procedure OnExitHandler(Sender: TObject);
Description
Routes OnExit event handling to script procedure named "<SenderName>_OnExit". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Edit1.OnExit:= ekWSHControl1.OnExitHandler": Edit1.OnExit handling will be routed to "Edit1_OnExit()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnExitHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnHideHandler
TekWSHControl
procedure OnHideHandler(Sender: TObject);
Description
Routes OnHide event handling to script procedure named "<SenderName>_OnHide". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnHide:= ekWSHControl1.OnHideHandler": Form1.OnHide handling will be routed to "Form1_OnHide()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events

If you will assign OnHideHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnKeyDownHandler
TekWSHControl
procedure OnKeyDownHandler(Sender: TObject; var Key: Word; Shift: TShiftState);
Description
Routes OnKeyDown event handling to script procedure named "<SenderName>_OnKeyDown". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnKeyDown:= ekWSHControl1.OnKeyDownHandler": Panel1.OnKeyDown handling will be routed to "Panel1_OnKeyDown()" if such procedure exists in the script)

Key and Shift parameters of TKeyEvent are incapsulated in TKeyEventArgs class. OnKeyDownHandler procedure creates TKeyEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.Key" or "Params.Shift"

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will press a key with [SHIFT] and [ALT] buttons pushed, Panel1_OnKeyDown_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TKeyEvent or similar events which require similar parameters

If you will assign OnKeyDownHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnKeyPressHandler
TekWSHControl
procedure OnKeyPressHandler(Sender: TObject; var Key: char);
Description
Routes OnKeyPress event handling to script procedure named "<SenderName>_OnKeyPress". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnKeyPress:= ekWSHControl1.OnKeyPressHandler": Panel1.OnKeyPress handling will be routed to "Panel1_OnKeyPress()" if such procedure exists in the script)

Key parameter of TKeyPressEvent is incapsulated in TKeyPressEventArgs class. OnKeyPressHandler procedure creates TKeyPressEventArgs instance, fills it with passed value and passes it as second parameter (the first is Sender) to script procedure, so parameter can be accesses within script handler as properties of this object, i.e. "Params.Key".

Notes
This router works only for TKeyPressEvent or similar events which require similar parameters

If you will assign OnKeyPressHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnKeyUpHandler
TekWSHControl
procedure OnKeyUpHandler(Sender: TObject; var Key: Word; Shift: TShiftState);
Description
Routes OnKeyUp event handling to script procedure named "<SenderName>_OnKeyUp". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnKeyUp:= ekWSHControl1.OnKeyUpHandler": Panel1.OnKeyUp handling will be routed to "Panel1_OnKeyUp()" if such procedure exists in the script)

Key and Shift parameters of TKeyEvent are incapsulated in TKeyEventArgs class. OnKeyUpHandler procedure creates TKeyEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.Key" or "Params.Shift"

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will press a key with [SHIFT] and [ALT] buttons pushed, Panel1_OnKeyUp_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TKeyEvent or similar events which require similar parameters

If you will assign OnKeyUpHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseDownHandler
TekWSHControl
procedure OnMouseDownHandler(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: integer; Y: integer);
Description
Routes OnMouseDown event handling to script procedure named "<SenderName>_OnMouseDown". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseDown:= ekWSHControl1.OnMouseDownHandler": Panel1.OnMouseDown handling will be routed to "Panel1_OnMouseDown()" if such procedure exists in the script)

Button, Shift, X and Y parameters of TMouseEvent are incapsulated in TMouseEventArgs class. OnMouseDownHandler procedure creates TMouseEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.X" or "Params.Shift"

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you press mouse button with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseDown_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseEvent or similar events which require similar parameters

If you will assign OnMouseDownHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseMoveHandler
TekWSHControl
procedure OnMouseMoveHandler(Sender: TObject; Shift: TShiftState; X: integer; Y: integer);
Description
Routes OnMouseMove event handling to script procedure named "<SenderName>_OnMouseMove". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseMove:= ekWSHControl1.OnMouseMoveHandler": Panel1.OnMouseMove handling will be routed to "Panel1_OnMouseMove()" if such procedure exists in the script)

Shift, X and Y parameters of TMouseMoveEvent are incapsulated in TMouseMoveEventArgs class. OnMouseMoveHandler procedure creates TMouseMoveEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.X" or "Params.Shift"

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will move mouse with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseMove_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseMoveEvent or similar events which require similar parameters

If you will assign OnMouseMoveHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseUpHandler
TekWSHControl
procedure OnMouseUpHandler(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X: integer; Y: integer);
Description
Routes OnMouseUp event handling to script procedure named "<SenderName>_OnMouseUp". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseUp:= ekWSHControl1.OnMouseUpHandler": Panel1.OnMouseUp handling will be routed to "Panel1_OnMouseUp()" if such procedure exists in the script)

Button, Shift, X and Y parameters of TMouseEvent are incapsulated in TMouseEventArgs class. OnMouseUpHandler procedure creates TMouseEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.X" or "Params.Shift"

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you press mouse button with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseUp_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseEvent or similar events which require similar parameters

If you will assign OnMouseUpHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseWheelDownHandler
TekWSHControl
procedure OnMouseWheelDownHandler(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
Description
Routes OnMouseWheelDown event handling to script procedure named "<SenderName>_OnMouseWheelDown". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseWheelDown:= ekWSHControl1.OnMouseWheelDownHandler": Panel1.OnMouseWheelDown handling will be routed to "Panel1_OnMouseWheelDown()" if such procedure exists in the script)

Shift, MousePos and Handled parameters of TMouseWheelUpDownEvent are incapsulated in TMouseWheelUpDownEventArgs class. OnMouseWheelDownHandler procedure creates TMouseWheelUpDownEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Param2.Handled", "Param2.MousePos_X" or "Param2.Shift".

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will press a key with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseWheelDown_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseWheelUpDownEvent or similar events which require similar parameters.

If you will assign OnMouseWheelDownHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseWheelHandler
TekWSHControl
procedure OnMouseWheelHandler(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
Description
Routes OnMouseWheel event handling to script procedure named "<SenderName>_OnMouseWheel". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseWheel:= ekWSHControl1.OnMouseWheelHandler": Panel1.OnMouseWheel handling will be routed to "Panel1_OnMouseWheel()" if such procedure exists in the script)

Shift, WheelDelta, MousePos and Handled parameters of TMouseWheelEvent are incapsulated in TMouseWheelEventArgs class. OnMouseWheelHandler procedure creates TMouseWheelEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.Handled", "Params.MousePos_X" or "Params.Shift".

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will press a key with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseWheel_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseWheelEvent or similar events which require similar parameters.

If you will assign OnMouseWheelHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnMouseWheelUpHandler
TekWSHControl
procedure OnMouseWheelUpHandler(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
Description
Routes OnMouseWheelUp event handling to script procedure named "<SenderName>_OnMouseWheelUp". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously.

(i.e. "Panel1.OnMouseWheelUp:= ekWSHControl1.OnMouseWheelUpHandler": Panel1.OnMouseWheelUp handling will be routed to "Panel1_OnMouseWheelUp()" if such procedure exists in the script)

Shift, MousePos and Handled parameters of TMouseWheelUpDownEvent are incapsulated in TMouseWheelUpDownEventArgs class. OnMouseWheelUpHandler procedure creates TMouseWheelUpDownEventArgs instance, fills it with passed values and passes it as second parameter (the first is Sender) to script procedure, so parameters can be accesses within script handler as properties of this object, i.e. "Params.Handled", "Params.MousePos_X" or "Params.Shift".

Notes
Sets and enumerated types (such as TShiftState, TCloseAction or similar) are represented as string with value name(s), separated by comma (for sets). I.e. if you will press a key with [SHIFT] and [ALT] buttons pushed, Panel1_OnMouseWheelUp_Args.Shift will be represented in script as string "ssShift,ssAlt"

This router works only for TMouseWheelUpDownEvent or similar events which require similar parameters.

If you will assign OnMouseWheelUpHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnPaintHandler
TekWSHControl
procedure OnPaintHandler(Sender: TObject);
Description
Routes OnPaint event handling to script procedure named "<SenderName>_OnPaint". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnPaint:= ekWSHControl1.OnPaintHandler": Form1.OnPaint handling will be routed to "Form1_OnPaint()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events which do not require parameters

If you will assign OnPaintHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnResizeHandler
TekWSHControl
procedure OnResizeHandler(Sender: TObject);
Description
Routes OnResize event handling to script procedure named "<SenderName>_OnResize". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Panel1.OnResize:= ekWSHControl1.OnResizeHandler": Panel1.OnResize handling will be routed to "Panel1_OnResize()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events which do not require parameters

If you will assign OnResizeHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnShowHandler
TekWSHControl
procedure OnShowHandler(Sender: TObject);
Description
Routes OnShow event handling to script procedure named "<SenderName>_OnShow". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Form1.OnShow:= ekWSHControl1.OnShowHandler": Form1.OnShow handling will be routed to "Form1_OnShow()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events which do not require parameters

If you will assign OnShowHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.OnTimerHandler
TekWSHControl
procedure OnTimerHandler(Sender: TObject);
Description
Routes OnTimer event handling to script procedure named "<SenderName>_OnTimer". For controls added during script execution, event handler set automatically if it presents in script body.

For controls which exist in application irrespective of the script, handlers from script must be set obviously

(i.e. "Timer1.OnTimer:= ekWSHControl1.OnTimerHandler": Timer1.OnTimer handling will be routed to "Timer1_OnTimer()" if such procedure exists in the script)

Notes
This router works only for TNotifyEvent or similar events which do not require parameters

If you will assign OnTimerHandler to another kind of events then unhandled "Access violation" exception may be raised due to stack crash


TekWSHControl.ProxyDestroyed
TekWSHControl
Removes proxy from internal list.
procedure ProxyDestroyed(Address: Pointer);
Description
Called internally from TWSHProxy.Destroy method.
Notes
This method is implemented and used internally, you don't need to obviously implement or use it in your source code. But you may need to call it obviously in case of writing your custom descendant from its methods.

TekWSHControl.RegisterClass
TekWSHControl
procedure RegisterClass(const Name: String; AClass: TPersistent);
Parameters
const Name: String
The name for object to be used in script.
AClass: TPersistent
Instance of object to be added to script
Description
Makes object visible and accessible for script engine. Creates proxy object imlementing IDispatch interface for class of instance defined by "AClass" parameter and adds it to script's namespace. with symbolic name defined by "Name" parameter.

After registering, all published members of object become visible and operatable from script

Notes
Any object must be registered using RegisterClass method to be accessible in script Also it is required to register object's class in application using Classes.RegisterClass to let control to obtain RTTI (which is usually dropped by compiler due to code optimization)

TekWSHControl.Reset
TekWSHControl
Resets control properties to default values and clears scripts body, objects, procedures etc.
procedure Reset; override;
Description
Reset method discards all scripting code and objects that have been added to the script control.
Notes
After Reset method is called, you need to add all objects, script code etc. again to run script.

TekWSHControl.RunProc
TekWSHControl
Runs named procedure or function contained in script text, with or without parameters.
function RunProc(const Name: string; ThrowExceptionIfNotFound: Boolean = True): OleVariant; overload;
function RunProc(const Name: string; argArray: array of OleVariant; ThrowExceptionIfNotFound: Boolean): OleVariant; overload;
Parameters
const Name: string
the name of script procedure or function to run
ThrowExceptionIfNotFound: Boolean = True
if False, then no exception is thrown if procedure with given name is not found in the script (in other word, nothing happens when trying to call procedure which doesn't exists.
argArray: array of OleVariant
array of parameters to be passed to script procedure/function
Return Value
NULL if called script routine is procedure, function result if called script routine is function
Description
Procedures defined in script text are accessible from application after adding script text by AddCode method.
Notes
To pass object parameter to script procedure, use TekWSHControl.GetOleObject method

TekWSHControl.RunProc
TekWSHControl
Runs named procedure or function contained in script text, with or without parameters.
function RunProc(const Name: string; ThrowExceptionIfNotFound: Boolean = True): OleVariant; overload;
function RunProc(const Name: string; argArray: array of OleVariant; ThrowExceptionIfNotFound: Boolean): OleVariant; overload;
Parameters
const Name: string
the name of script procedure or function to run
ThrowExceptionIfNotFound: Boolean = True
if False, then no exception is thrown if procedure with given name is not found in the script (in other word, nothing happens when trying to call procedure which doesn't exists.
argArray: array of OleVariant
array of parameters to be passed to script procedure/function
Return Value
NULL if called script routine is procedure, function result if called script routine is function
Description
Procedures defined in script text are accessible from application after adding script text by AddCode method.
Notes
To pass object parameter to script procedure, use TekWSHControl.GetOleObject method

TekWSHControl.SetHandler
TekWSHControl
Applies script procedure to be event handler for Delphi object (Control parameter).
procedure SetHandler(Control: TPersistent; Name: string);
Description
Called internally from TekWSHProxy.DoCreateControl method.
Notes
This method is implemented and used internally, you don't need to obviously implement or use it in your source code. But you may need to call it obviously in case of writing your custom descendant from its methods.

TekWSHControl.OnAddControlFromScript
TekWSHControl
Occurs after Delphi object is added during script execution
property OnAddControlFromScript: TAddControlEvent;
Description
Lets to assign script procedures as event handlers for added object.

Ekas Software Windows Script Host Control for Delphi Help
Copyright (c)2002,2003 Ekas Software