The Big Red Toolbox

S309UserNotification

A control that puts up a Windows CE User Notification

September 26, 1999

Copyright 1999 NS BASIC Corporation


NS Basic is (c) NS Basic Corporation
Windows CE is (c) Microsoft Corporation

The S309UserNotification.ocx version 1.3 provides an ActiveX control that can display a Windows CE User Notification dialog box (the same dialog used for reminders).




Object Creation

AddObject "S309.UserNotification.1","un",0,0

Samples

Properties
Name Values Description
AppName string A string that contains the name of an executable that is used to get an icon for the dialog at notification time when using the Set method or that is to be executed when using the RunAppAtTime Method.
DateTime variant Any variant that can be converted to a date and time.
Dialog True|False Determines whether a dialog box should be displayed at notification time.
DialogText string The text for the dialog to display.
DialogTitle string The title for the dialog to display.
LED True|False Determines whether the LED will flash on the Windows CE machine.
Left integer Pixels from the left edge of the output window to left edge of ActiveX control.GetUserPreferences method uses this to determine where to display the dialog. It will try to center the dialog on top of the control.
Repeat True|False Repeat playing the SoundFile for 10-15 seconds if Sound=True.
Sound True|False Determines whether to play a sound at notification time.
SoundFile string The name of the .wav file to play. If you are using GetUserPreferences method this should be the name a the .wav file only, not the path, name, and extension.
Tag variant User defined.
Top integer Pixels from top edge of output window to top edge of ActiveX control.GetUserPreferences method uses this to determine where to display the dialog. It will try to center the dialog on top of the control.
VersionMajor integer Returns the major version of the S309UserNotification. (Read Only)
VersionMinor integer Returns the minor version of the S309UserNotification. (Read Only)
Vibrate True|False Determines whether to vibrate the Windows CE machine at notification time.
Methods
Name Parameter(s) Return Value Description
AboutBox     Displays the About Box for this ActiveX control.
Clear The handle returned from the Set method. True|False Cancels the UserNotification specified by handle. Returns False if there were errors.
GetUserPreferences   True|False Displays a dialog box allowing the user to specify preferences for sound, soundfile, repeat, dialogbox, and LED. If True is returned the user changed one or more options and the changes are reflected in the Properties for this control.
Handle The AppName specified with the RunAppAtTime or Set methods. True|False This method will notify Windows CE that the program has handled the notification events and will turn off the task bar annunciator and flashing LED. (I have found that if I Dialog=False and use the Set method the LED does not stop flashing on some units). Returns False if there were errors.
RunAppAtTime   True|False Will execute the program specified in the AppName property at the time specified in the DateTime property. Returns False if there were errors.
Set 0 for a new event or handle of event to modify. handle Will set or modify a User Notification. Returns 0 if there were errors.

Files Included

S309UserNotification.ocx - the ActiveX control
S309UserNotification.html - the documentation (this file).
S309UserNotification.nsb - a sample NS Basic program.

Installation of S309UserNotification ActiveX control on Windows CE

Transfer the ocx file for your processor to the \Windows directory

Register the control on Windows CE by doing:

Start - Run - regsvrce.exe \Windows\S309UserNotification.ocx

You should get a return code of 0.

How to register objects on Palm-size devices:

- or -

Use NS Basic/CE's SHELLEXECUTE command. There's an example in the Handbook.

Using the S309UserNotification ActiveX control in NS Basic

Dim Handle
AddObject "S309.UserNotification.1", "un", xpos, ypos
un.Dialog = True
un.Sound = True
un.SoundFile = "Alarm2"
un.LED = True
un.Repeat = False
un.GetUserPreferances()
if un.Dialog then
  un.DialogTitle = "This is the Title"
  un.DialogText = "This is the Text"
end if
un.AppName = "S309UserNotification.ocx"   ' display icon from executable
un.DateTime = now + timeserial(0,0,5)   ' show in 5 seconds.
Handle = un.Set(0)  ' create a new event

"un" can be any name
xpos is the x-coord
ypos is the y-coord

The latest version of the S309UserNotification ActiveX control can be found here.