OleRegisterServer

  OLESTATUS OleRegisterServer(lpszClass, lpsrvr, lplhserver, hInst, srvruse)    
  LPCSTR lpszClass; /* pointer to string for class name */
  LPOLESERVER lpsrvr; /* pointer to OLESERVER structure */
  LHSERVER FAR* lplhserver; /* pointer to server handle */
  HANDLE hInst; /* instance handle */
  OLE_SERVER_USE srvruse; /* single or multiple instances */

The OleRegisterServer function registers the specified server, class name, and instance with the server library.

Parameters

lpszClass

Points to a null-terminated string specifying the class name being registered.

lpsrvr

Points to an OLESERVER structure allocated and initialized by the server application.

lplhserver

Points to a variable of type LHSERVER in which the library stores the handle to the server. This handle is used in such functions as OleRegisterServerDoc and OleRevokeServer.

hInst

Identifies the instance of the server application. This handle is used to ensure that clients connect to the correct instance of a server application.

srvruse

Specifies whether the server uses a single instance or multiple instances to support multiple objects. This value can be either OLE_SERVER_SINGLE or OLE_SERVER_MULTI.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which can be OLE_ERROR_PROTECT_ONLY, OLE_ERROR_CLASS, or OLE_ERROR_MEMORY.

Comments

When the server application starts, it creates a OLESERVER structure and calls the OleRegisterServer function. Servers that support several class names can allocate a structure for each or reuse the same structure. The class name is passed to server-application functions that are invoked through the library, so that servers that support more than one class can determine which class is being requested.

The srvruse parameter is used when the libraries open an object. When OLE_SERVER_MULTI is specified for this parameter, a new instance of the server is started whenever all current instances are already editing an object. Servers that support the multiple-document interface (MDI) typically specify OLE_SERVER_SINGLE.

See Also

OleRegisterServerDoc, OleRevokeServer