All Manuals > COM/Automation User Guide and Reference Manual > 4 Automation Reference Entries

create-object Function

Summary

Create an instance of a coclass.

Package

com

Signature

create-object &key clsid progid clsctx => interface-ptr

Arguments
clsid
A string giving a CLSID to create.
progid
A string giving a ProgID to create.
clsctx
A CLSCTX value, which defaults to CLSCTX_SERVER.
Values
interface-ptr
An i-dispatch interface pointer.
Description

The function create-object creates an instance of a coclass and returns its i-dispatch interface pointer. The coclass can be specified directly by supplying clsid or indirectly by supplying progid, which will locate the CLSID from the registry.

clsctx indicate the execution contexts in which an object is to be run. It defaults to CLSCTX_SERVER.

Notes

You must initialize the COM runtime before calling create-object (see 1.4 Initializing the COM runtime).

Examples

The following are equivalent ways of creating an Microsoft Word application object:

(create-object :progid "Word.Application.8")
(create-object
  :clsid "000209FF-0000-0000-C000-000000000046")
See also

with-coclass


COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:41