OLEObject.Constructor(ProgramID as String, NewInstance as Boolean)

From Xojo Documentation

Revision as of 22:50, 29 August 2019 by Gperlman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Constructor


OLEObject.Constructor(ProgramID as String, NewInstance as Boolean)

Creates a new OLEObject using the passed ProgramID is the COM server’s program ID as stored in the registry. The NewInstance parameter specifies whether to create a new instance of the COM server (True) or try to use an existing one if it is running (False).

Example

The following example automates Internet Explorer.

Var obj As OLEObject
Var v As Variant
Var params(1) As Variant

obj = New OLEObject("InternetExplorer.Application", True)
obj.Value("Visible") = True
params(1) = "http://www.realsoftware.com/%22
v = obj.Invoke("Navigate", params)

Exception err As OLEException
MessageBox(err.Message)