Overview
Recorder Custom Control Contents

Description

The Recorder custom control is designed to allow a Visual Basic application access to the powerful facilities of windows journaling. Possible applications of this include macro recording and playback abilities within an application, building simple CBT applications, and recording scripts for application testing. Sets of recorded messages can be stored to file and played back later at either recorded speed or high speed. All messages can be recorded or this can be restricted to keystrokes only. Messages can be recorded relative to the position of a specific window by setting a hwnd property at run time, this being of particular importance to messages whose effect depends on the cursor position such as mouse clicks or drag over events. Playback of messages can be aborted by pressing the ESC key or this feature can be disabled by setting a property in the control.

File Name

Recorder.Vbx

About Recorder Custom Control

Registering

Miscellaneous

Custom Properties

       PlaybackFileName

       RecordFileName

       PlaybackSpeed

       MessageType

       Record

       Playback

       RecordPlaybackRelativeTo

       AllowCancel

Events

       Finished

Errors

       Error Messages


PlaybackFileName
Recorder Control  -  PlaybackFileName

Description

The PlaybackFileName determines the file name that will be used by the control as a source of recorded messages for playback. To use such a file, it must have been previously recorded using the control and this is determined by reading the file header before attempting to playback. An invalid file will generate an error. If this property is set to an empty string then the control attempts to playback from a data structure stored in memory should one already exist.

Syntax

Recorder.PlaybackFileName [= FileName$]

Data Type

String


RecordFileName
Recorder Control  -  RecordFileName

Description

The RecordFileName property determines the name of the file to which messages are recorded. The file is initialised with a header which allows the control to authenticate the file when it is played back. If this string is left blank then messages are recorded to a memory structure.

Syntax

Recorder.RecordFileName [= FileName$]

Data Type

String


PlaybackSpeed
Recorder Control  -  PlaybackSpeed

Description

The PlayBackSpeed property determines the speed at which the playback of events takes place. This can be set to 0 ( normal ) or 1 (fast). The default setting is 0 at which playback takes place at the same speed that the events were recorded. Setting playback speed to 1 causes all events to be played back consecutively without an intervening time period between events. The hi speed playback of keystrokes feature is most appropriately used with the Keystrokes only setting of MessageType because in cases where there are time dependencies the hi speed playback of mouse messages may fall out of sync with events which are being responded to.

Syntax

Recorder.PlayBackSpeed [= PlaybackSpeed%]

Data Type

Integer


MessageType
Recorder Control  -  MessageType

Description

The MessageType property determines the type of messages which are recorded. Setting this property to 0 ( keystrokes only ) means that only keystroke events are recorded and all other events, mouse movement, clicks etc. are ignored. Setting this property to 1 removes this filter and allows all messages to be recorded. Setting this property to keystrokes only is useful for manipulating menu items and controls which are accessible through mnemonics and is independent of the positions of controls on a screen, unlike such a manipulation performed by playing a set of mouse actions.

Syntax

Recorder.MessageType [= MessageType%]

Data Type

Integer


Record
Recorder Control  -  Record

Description

The Record property is an action property which is accessible at run-time only. Setting this property to true initiates the recording of messages. Setting it to false terminates the recording session. If the RecordFileName property has been set to a valid string, then the recorded events are stored to memory. Otherwise they are written to the file whose name is given by the RecordFileName property.

Syntax

Recorder.Record = record%

Data Type

Integer (Boolean)


Playback
Recorder Control  -  Playback

Description

The Playback property is an action property which like the Record property is accessible at run-time only. Setting this property to true initiates the playback of messages previously stored to file or memory using the Record property. The playback continues until completion unless the AllowCancel property is set to true and the ESC key is pressed mid session, which aborts the playback. All queuing of input from the mouse and keyboard is disabled during the playback. Depending on whether the PlaybackFileName property has been set to a non-empty string, the events are either played back from memory or from the file whose name is given by the PlaybackFileName property. If the PlaybackFileName string is blank, and there are no previously recorded events in memory, an error is generated.

Syntax

Recorder.Playback = playback%

Data Type

Integer (Boolean)


RecordPlaybackRelativeTo
Recorder Control  -  RecordPlaybackRelativeTo

Description

The RecordPlaybackRelativeTo property can be used to specify a window which all mouse messages are recorded and played back relative to. To do so, assign the property to the hWnd property of the form or other control. This property is accessible at run time only and must be set dynamically in code after the window is created, such as in a form load event. If events are recorded with this property set, then they must be played back with it set also. Using this property will make all playbacks independent of a window' s position on the screen. If the position of some of the controls used by the playback depend on the size of the window, for instance, controls which align themselves with the bottom or sides of the window, a playback recorded when the window was a different size will not execute correctly irrespective of whether this property is set. For such cases, setting the MessageType property to keystrokes only and recording only keystrokes will likely produce a better result.

Syntax

Recorder.RecordPlaybackRelativeTo [= hwnd%]

Data Type

Integer


AllowCancel
Recorder Control  -  AllowCancel

Description

The AllowCancel property determines whether a playback ( see the Playback property ) can be halted by pressing the ESC key. Setting this property to TRUE allows the playback to be halted, otherwise the playback must run to completion.

Syntax

Recorder.AllowCancel [= Bool%]

Data Type

Integer (Boolean)


Finished
Recorder Control  -  Finished Event

Description

The Finished event takes place when playback of events terminates. This control takes one argument, UserCancel which is true if the playback was terminated by pressing the ESC key.


Error Messages
Recorder Control  -  Error Messages

Error No. 20001

The filename given in the PlaybackFileName property could not be found.

Error No 20002

There was a problem allocating memory to perform a playback.

Error No 20003

The filename given in the PlaybackFileName property was an invalid playback file or was empty.

Error No 20004

The file was recorded as non relative to a window but is being played back with the RecordPlaybackRelativeTo property set to a window's hwnd. As such, the playback would not perform correctly. To correct this problem, make sure that the RecordPlaybackRelativeTo property is set to 0.

Error No 20005

The file was recorded as relative to a window but is being played back without the RecordPlaybackRelativeTo property being set to the windows hwnd. As such, the playback would not perform correctly unless the screen was in exactly the same state as it was during the recording of events. Setting the RecordPlaybackRelativeTo to the window's hwnd property before playback will correct this problem.

Error No 20006

Nothing to playback. There are no previously recorded events in memory with which to perform a playback.


Registering
Registering the Recorder Control

This custom control is Shareware. You may freely distribute it to other Visual Basic developers. If, after a evaluationary period of twenty eight days, you decide to continue using it, you should register the control by printing and filling out the registration form, and enclosing a cheque, bank draft or postal order. The source code for the control, in C, is also available.

The prices are as follows:

Registration : IR£15.00, Stg£15.00 or US$20.00.

Registration and source code IR£40.00, Stg£40.00 or US$55.00.

If you want the control posted on floppy disk, add £1.50 / $2.00.

Cheques or Bank Drafts in other hard currencies equivalent in value to the above are also acceptable. These should be made payable to and sent to the following:

Robert Mullins,

Ballyknockane,

Clonmel,

Co. Tipperary,

Rep. of Ireland.

In return, you will be sent the most up to date version of the recorder control in which the popup window does not appear on loading the control, and which is personally registered to the user, and if specified, the source code. If an e-mail address is supplied, any future revisions/bug fixes will be sent to you via e-mail. Please indicate which form of delivery you require. Any comments or suggestions for improvements would also be welcome. Feel free to contact me with any queries you may have. My e-mail address is rmullins@iol.ie .

OCX version

I am currently in the process of developing a 16 / 32 bit ocx version of this control. If you would like to receive a beta/trial version of this control ( depending on its state at the time ) when you register the vbx control, indicate on the registration form.

Disclaimer of Warranty

This custom control is distributed as is. I have done my best to ensure that this control is bug free. However, it is the responsibility of the developer who uses the recorder control to ensure that it operates correctly and any applications which use it are thoroughly tested with non-critical data before being relied upon. The author can accept no liability for loss of data or any other problems which may arise through use of this control.


Miscellaneous
Miscellaneous Issues

Installation

The custom control file, vbhook.vbx, should be copied to the windows\system directory. The help file, vbrecord.hlp, should be copied to the \windows directory.

Multiple instances

The recorder control should ideally be used as a singleton control within a project particularly if recording and playback of events to memory is being used. Multiple instances of the control share common memory for tracking messages so all instances will play back the last set of messages recorded by any other instance. Similarly, instances of the control in different applications will also exhibit this effect. Future releases of the control may address this issue.

Compatibility

The recorder control is compatible with Microsoft Visual Basic version 1.0 upwards and while it has not been tested rigorously in other environments it should be compatible with any environment which supports the vbx custom control standard such as Microsoft Visual C++ 16 bit editions and Borland's Delphi. The control also performs correctly under Microsoft Windows 95.


Registration Form

To register, print the following form and send it to the given address:

---------------------------------------------------------------------------------------------------------------------

Recorder Custom Control Version 1.1

I enclose a cheque / bank draft for _____________ in payment for ______ copies of the Recorder custom control / Recorder custom control and source code.

Name(s)	_________________________________________________________

_________________________________________________________

Company	_________________________________________________________

Address	_________________________________________________________

_________________________________________________________

_________________________________________________________

_________________________________________________________

Email Address	_________________________________________________________

Where did you

get the control	_________________________________________________________

Include Trial/Beta OCX	Yes  O	No  O

Comments	_________________________________________________________

_________________________________________________________

_________________________________________________________