The OPC DataHub can be run as a Windows service instead of as a normal program. It cannot be run as a service and a normal program simultaneously—it must be installed as one or the other. Windows XP, 2003, NT and 2000 allow you to access the DataHub System Tray icon when running as a service, whereas Windows Vista, 7, and 2008 do not. Thus the procedures involved in running the DataHub as a service are different for these two groups of Windows operating systems, and are discussed separately.
When running the OPC DataHub as a service in Windows XP, 2003, NT and 2000 you can start and stop the program, and access the programfiles from the menu.
To install as a service, from the Windowsmenu, choose , then , and then . The DataHub will start up and run. Each time Windows starts up, the DataHub will start as well. To uninstall as a Windows service, choose from the same menu. The DataHub will shut down, and can be restarted manually.
Services are run as a privileged user, so you may need to modify the COM permissions on your system to use this mode.
When you install the DataHub as a service, the DataHub remembers who you are, and will use the configuration files associated with your user name. This allows you to switch between running the DataHub as a service or as a normal user without having to switch configurations. However, if another administrative user on the computer were to uninstall the DataHub as a service, and then install it again as a service, this would cause the DataHub to use that other user's configuration files thereafter.
The easiest approach to configuring the OPC DataHub when running as a service is to create a Windows user who is allowed to configure the DataHub. As that user, you configure the DataHub normally, and then install it as a service.
The DataHub will use those same configuration settings even when the user is not logged on, because the DataHub refers to that user's Application Data directory as the source for its configuration files. The configuring user can switch back and forth between process mode and service mode, and the DataHub will continue to use the same configuration files. It does this by running the service with a -H option on the command line, pointing to the user's configuration directory.
When the OPC DataHub is running as a service, it must run as the SYSTEM account, or it will not be able to access the Windows desktop.
If the service is running as SYSTEM, then you can tell the OPC DataHub to display its tray icon and property dialog by double-clicking on the OPC DataHub icon in the Windows Control Panel.
The tray icon and the properties dialog will appear on the primary Windows console. If you are logged into the computer remotely, you will need to connect to the primary console using this command:
Older versions of Windows, including Windows XP up to Sevice Pack 2, should use this command:
If the control panel icon does not work, it may be due to missing DLLs in the Windows system32 directory. You can safely copy the following files from C:\Program Files\Cogent\OPC DataHub into C:\Windows\system32, but do not overwrite any existing files in the system32 directory:
atl71.dll mfc71u.dll msvcr71.dll
Now the icon in the control panel should show the icon in the system tray.
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.