Servers

Servers presents a collection interface to use within a Project object. It exposes each of the OLE servers defined within your project

Usage

oServer = oProject.Servers.Item[ nIndex ] |
          oProject.Servers[ nIndex ]
nCount = oProject.Servers.Count

Parameter

Value

Meaning

nIndex

Positive Integer

Enumerates a server item within the project.

oServer

Server object

The server object returned from the collection.

nCount

Integer

The number of servers defined within the project.


The Servers collection is another of those strange COM collections we are meeting more and more within VFP. It's not exactly an array of items, as it has properties of its own, such as Count, but it's not a full-fledged object either, really, because it doesn't really do anything itself. We'd better get used to these—the world of COM is full of them.In this case, Servers is a collection of all OLEPublic interfaces exposed within the Project. Count tells you how many there are. The Item method can be used to access its contained servers, though a subscript on the Servers collection itself does the same thing, as shown in the Usage.One thing that confused us about Servers at first: The collection doesn't show your server objects until the project has been built at least once. That makes some sense if you consider that it's only during the build process that the Project Manager actually scans the code.

Example

MODIFY PROJECT MySample NOWAIT
oProject = _VFP.ActiveProject
? oProject.Servers.Count  && displays the servers available
FOR EACH oServer in oProject.Servers
  ? oServer.CLSID         && display the Class ID for each
NEXT

See Also

Count Property, Item, Project, Server


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .