   Help for Alarm

Properties	Events	Methods

Registration Information

Order Form

Getting Custom Controls Written

Description

Alarm is a Visual Basic custom control that lets you set multiple alarms to go off (i.e., fire events) at various times during the day.  This control makes it easy to schedule events to happen at various times.  Just set the properties and wait for Alarm to notify you.

Alarm even tells you when the date has changed.  You can use this to remove all of the current alarms and set new ones for the day.  A must if you're writing a PIM.

File Name

ALARM1.VBX

Object Type

MabryAlarm

Distribution Note     When you develop and distribute an application that uses Alarm, you should install the file ALARM1.VBX into the users Windows SYSTEM directory.  Alarm has version information built into it.  So, during installation, you should ensure that you are not overwriting a newer version of Alarm.


Properties

All of the properties that apply to this control are in this table.  Properties that have special meaning for this control or that only apply to this control are marked with an asterisk (*).

*AlarmTime

Align

*DateFormat

Enabled

Left

Name

Tag

Top

Enabled is the default value for the control.


AlarmTime Property

See Also	Example

Description

Determines the time(s) that the Alarm event is fired.

Usage

[form.][control.]AlarmTime(AlarmIndex)[ = time ]

Remarks

Setting this property sets an alarm.  AlarmIndex determines the identifier of the alarm, which is passed to the Alarm event.  If this property is set to a blank string, the alarm identified by AlarmIndex is canceled.

The time specified must be in this format:  MM:MM:SS   Where HH, MM, and SS are either digits or question marks '?'.  The colons are required.  Question marks act as wildcards.

The Alarm control checks the time every second.  If the time string set in the various alarms matches the current time (including any wildcards used), the Alarm event is fired.

Data Type

String


See Also

Events:

Alarm


Alarm Example

In this example, the program show how to make a simple digital clock that beeps every quarter hour.  It beeps twice on the half hour, once each at 15 minutes and 45 minutes past the hour, and once for every hour on the hour (i.e., 9 times at 9pm, 11 times at 11am, etc.). To try this example, paste the code into the Declarations section of a form that contains two labels, and an Alarm control.  Press F5.

Dim nAlarms As Integer

Sub Alarm_Add( T As String )

    Alarm1.AlarmTime( nAlarms ) = T

    nAlarms = nAlarms + 1

End Sub

Sub Form_Load ()

    Dim I As Integer

    Dim J As Integer

    Dim T As String

    Label1.Caption = Time$

    Label2.Caption = Date$

    Alarm1.DateFormat = "mm-dd-yyyy"

    nAlarms = 0

    ' alarm 0 is to update the time

    Alarm_Add( "??:??:??" )

    ' Quarter-hour chimes

    Alarm_Add( "??:30:00" )

    Alarm_Add( "??:30:01" )

    ' Half-hour chimes

    Alarm_Add( "??:15:00" )

    Alarm_Add( "??:45:00" )

    ' Fill in alarms for the day

    For I = 0 To 23

        For J = 0 To ((I + 11) Mod 12) + 1

            T = Format$( I, "00" ) & ":00:"

            T = T & Format$( J, "00" )

            Alarm_Add( T )

        Next J

    Next I

End Sub

Sub Alarm1_Alarm (AlarmIndex As Long, TimeNow As String)

    ' update the time caption

    Label1.Caption = TimeNow

    ' when it's not just a time update alarm, beep

    If AlarmIndex <> 0 Then Beep

End Sub

Sub Alarm1_NewDate (DateNow As String)

    ' update the date caption

    Label2.Caption = DateNow

End Sub


DateFormat Property

See Also	Example

Description

Determines the format of the date passed by the NewDate event..

Usage

[form.][control.]DateFormat[ = date ]

Remarks

Setting this property determines the format of the date sent with the NewDate eventNewDate event.  This can be used to override the international settings found in WIN.INI.  Using this property, you can ensure that you always get a date formatted in a specific fashion.  If you leave it to the format found in WIN.INI, you'll have to figure out what format (i.e., MM/DD/YY, DD/MM/YY, or YY/MM/DD) it is.

This string can consist of punctuation and symbols.  The symbols are:

Symbol	Meaning

d	Day of the month: 1 - 31

dd	Day of the month: 01-31

m	Month of the year: 1 - 12

mm	Month of the year: 01-12

yy	Year: 00-99

yyyy	Year: 1970 - 2099

More information about this format can be found in the Windows Resource Kit under [intl] Section, and in the VB Programmer's Guide under Format$.

Data Type

String


See Also

Events:

NewDate


Events

All of the events that apply to this control are in this table.  Events that have special meaning for this control or that only apply to this control are marked with an asterisk (*).

*Alarm

*NewDate


Alarm Event

Example

Description

Occurs when it's time for an alarm to fire.

Syntax

Sub ctlname_Alarm (AlarmIndex As Long, TimeNow As String)

Remarks

This event only occurs If the Enabled property is set to True (default).

The argument AlarmIndex holds the array index given to the Alarm for this time.  This index is the one used for the AlarmTime property.

The argument TimeNow tells what time it actually was when the event fired.  When the system is busy, the event may occur after the desired alarm time.


NewDate Event

Example

Description

Occurs when the date changes.

Syntax

Sub ctlname_NewDate (DateNow As String)

Remarks

This event only occurs If the Enabled property is set to True (default).

The argument DateNow holds the new date.  This is formatted using the International date format setup by the control panel.  This can be overridden using the DateFormat property.

Alarm uses the sShortDate entry found in the [INTL] section on WIN.INI.  This format can vary widely depending on what the user prefers. Use of the DateFormat property is highly recommended.


Methods

All of the methods that apply to this control are in this table.  Methods that have special meaning for this control or that only apply to this control are marked with an asterisk (*).

Clear (removes all alarms)


Registration Information

Credits

Alarm was written by James Shields.  Inquiries can be sent to 71231,2066 on CompuServe, or mabry@halcyon.com on Internet.  If you must send something via U.S. Mail, the address is:

Mabry Software

Post Office Box 31926

Seattle, WA  98103-1926

Registration

You can register this program by sending $10 ($12 for international orders) and your address.  CompuServe members may register by sending $5 and their account number (the registered version will be E-mailed to you).  CompuServe members may also register this package by going to the SWREG forum.  Alarm is registered there.  Alarms registration ID number is 1475.

For your convenience, an order form has been provided that you can print out directly from help.

Source Code and Registration

Source code (which includes a registered copy) to this control is available for $25 ($30 for international orders).  With source code you get a registered version of the control.  If you are a CompuServe member, you may get the source code in the Software Registration forum (GO SWREG) for $20.  It's registration number is 1476.

Credit Card Orders

You can order this program with Mastercard, Visa, American Express, or Discover from Public (software) Library by calling 800-2422-PsL or 713-524-6394 or by FAX to 713-524-6398 or by CompuServe E-mail to 71355,470.  You can also mail credit card orders to PsL at Post Office Box 35705; Houston, TX 77235-5705.  THESE NUMBERS ARE FOR CREDIT CARDS ONLY.

Alarm's ID number for this service is 11091.  This is good for both the normal registered version, and the source code version.

Any questions about the status of the shipment of the order, refunds, registration options, product details, technical support, volume discounts, dealer pricing, site licenses, etc., must be directed to Mabry Software at 206-634-1443 or FAX at 206-632-0272.

To ensure that you get the latest version, PsL will notify us the day of your order and we will ship the product directly to you.

© Copyright 1993-1994 by James Shields


Order Form
 Alarm Order Form

Use the Print Topic.. command from the File menu to print this order form.

Mail this	Mabry Software

form to:	Post Office Box 31926

Seattle, WA  98103-1926

Phone: 206-634-1443

Fax: 206-632-0272

BBS: WinDev BBS 206-634-0783

CompuServe: 71231,2066

Internet: mabry@halcyon.com

Where did you get this copy of Alarm?

____________________________________________________________________

Ship to:	____________________________________________________________________

____________________________________________________________________

____________________________________________________________________

____________________________________________________________________

____________________________________________________________________

Phone:	_________________________________________________________________

Fax:	_________________________________________________________________

E-Mail:	_________________________________________________________________

Disk Size:	(circle one)	 3½	5¼

qty ordered	____	REGISTRATION

$10 each, postpaid (check or money order in hard currency).  Foreign addresses add $2.00 shipping.  No additional shipping charges to Canada or Mexico.

qty ordered	____	SOURCE CODE AND REGISTRATION

$25 each, postpaid (check or money order in hard currency).  Foreign addresses add $5.00 shipping.  No additional shipping charges to Canada or Mexico.


Getting Custom Controls Written

If you or your organization would like to have custom controls written, you can contact me at the following:

James Shields

Mabry Software

Post Office Box 31926

Seattle, WA  98103-1926

Phone: 206-634-1443

Fax: 206-632-0272

BBS: WinDev BBS 206-634-0783

CompuServe: 71231,2066

Internet: mabry@halcyon.com