Click or drag to resize

GetObject Function

X#
-- todo --
Activates an Automation object and creates a reference to the object.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION GetObject(
	uType,
	cClassName
) AS Object CLIPPER
Request Example View Source

Parameters

uType (Optional)
Type: Usual
cClassName (Optional)
Type: Usual
Specifies the class name of the object to retrieve. Some applications can store more than one object type in the same file, making it possible for you to use the class name to specify the object to activate. For example, if a word processing application stores its documents, macro definitions, and ToolBar objects in the same file, you can create a reference to the document file with the following command:
X#
1MDOCFILE = GetObject('C:\WRDPROC\MYDOC.DOC','WrdProc.Document')
With some server applications, each time you issue GetObject( ), an additional instance of the application is started, using additional memory. If the application is already running, you can prevent additional instances of the application from starting by omitting FileName and including ClassName, as in this example:
X#
1oleApp = GetObject(, "Excel.Application")

Return Value

Type: Object
Object reference
Remarks
Use GetObject( ) to activate an Automation object from a file and to assign a reference to the object through a memory variable or array element. If you specify an invalid file or class name, an OLE error is displayed, and the GetObject( ) function returns an empty string.
Examples
X#
1*  Replace "DomainName" with the domain name, and "UserLoginID"
2*  with the login ID of the user you are looking up.
3oUser = GetObject("WinNT://DomainName/UserLoginID,user")
4? oUser.FullName
See Also