Using the NTService Control with VBVoice

The NTService control lets you run your application as a Windows Service process. Once installed as a Service, your application may be configured and administered using the standard Windows configuration tools. Specifically, you can configure it to start automatically after a system reboot -- a common requirement for a telephony server.

The control also provides functions for installing/uninstalling as a service, event logging, and registry management. The control is invisible at runtime.

Because Windows NT services normally runs without access to the desktop, you should ensure that the application does not require user input. You should detect all error conditions by placing On Error handlers in every event procedure.

Note: Be sure you can run VBVoice application normally before converting it into a NT service.

Dialogic Driver

VBVoice automatically starts the Dialogic driver upon System Start, therefore no special action is necessary. You may set driver startup mode to Automatic, by selecting Dialogic System Startup Mode/Automatic. Note that Pronexus has seen some problems with this method.

Setting Up the Application to Run as a Service

To set up your application to run as a service:

  1. Copy frmService.frm from the example Ezflow.vbp in the "..\Pronexus\VBVoice\netWorks\examples\NT Service" directory.

  2. Add it to your application.

  3. Make it the Startup form.

  1. Add the following code to your main VBVoice form to ensure that the application starts as soon as the form is loaded. Be sure to append a switch after StartSystem: False = no vbvlog, True = start vbvlog.

Sub Form_load()

   VBVFrame1.StartSystem False

End Sub

frmService Description

When the NT Service Controller requests the application to start, the Start event will be fired. In this event, the timer is enabled. When the timer expires, the main VBVoice form is loaded and StartSystem is called from the forms Load event. A timer is then used to allow a fast response to the initial Start event, in order to avoid timeouts in the NT Service controller.

Command Line Options

The code in the Form Load event is used to provide several command line options, including:

-debug

Starts the service in debug mode.

-normal

Runs your VBVoice application normally, not as a service.

-uninstall

Un-installs your installed VBVoice service.

anything else

Provides a listing of options

NT Service Property Settings

Dependencies

The service is configured to start after the appropriate voice card driver has loaded using the Dependencies property. Two null characters (chr(0) ) indicate the end of the dependency string. This property is used when the Install method is called.

Interactive

The default is True, which allows the application to appear on the desktop after a user logs in. This is equivalent to the Allow Service to Interact with Desktop option in the Service dialog that appears after you click the Startup... button in the NT Services control panel applet.

StartMode

Set to 2, svcStartModeAutomatic.

ServiceDisplayName

Set to your service name. Name is displayed in the Control Panel.

ServiceName

Name used in the Registry.

Setting Up Logging and LineStatus

When running a VBVoice application as a service VBVLog.exe and the LineStatus control will either not work or error since the VBVoice service by default is run under the "Local System" Account and not the "Current" Account. To remedy this, assign a logon account to your VBVoice Service.

Your VBVoice Service can be configured to log on to special user accounts so that the user may have access to resources such as VBVLog.exe, VBVoice LineStatus control and other files and folders protected by Windows 2000.

Assigning a Logon Account to your VBVoice Service

Once you have created an NT Service using the Pronexus NT Service Control, follow these steps to assign a logon account:

  1. Open your Control Panel \ Administrative Tools \ Services menu.

  2. Find and open your service.

  3. Select the Log On tab.

  4. Select This Account.

  5. Click Browse.

  6. Select name of account, such as Administrator.

  7. Click OK.

  8. Set password and confirm.

  9. Save and close.

  10. Start service.

Now you will be able to open VBVLog.exe from your shortcut menu and run the LineStatus control to view all logging information.

Installation

Requirements

For web browser integration you need a Web server, such as Microsoft Personal Web Server or IIS.

Core Support Files

VBVCOM.DLL

VBVRLOG.EXE

VBV32.OCX

Performance Monitor Integration

VBVPERF.DLL: Installed into system32, NT only.

VBVPERF.INI and GENCTRNM.H files for registration.

ADO Objects

VBV_ADO.DLL

Browser Integration

Copy the example htm files into a directory accessible from your web server. If a copy of Personal Web Server or IIS is found, the sample htm files will be copied to a new subdirectory netWorks, in the WWWROOT directory. In addition, shortcuts to all the files will be placed in the subdirectory HTM in the main install directory.

Distribution

Use the standard redistribution packages for VBVoice and follow the instructions below for other components of VBVoice netWorks.

Performance Monitor Integration

Installing VBVPERF.DLL:

  1. Install into windows\system32

  2. Un-register the old dll if replacing an existing copy

  3. Register the new dll

Run LODCTR VBVPERF.INI to install counters. The VBVPERF.INI and GENCTRNM.H files are required in the directory from which LODCTR is run.

ADO Objects

Register VBV_ADO.DLL

Browser Integration

Copy the htm files into a directory accessible from your web server. The Personal Web Server can be downloaded from the Microsoft web site.