导航:  COM (Component Object Model) > COM Procedures >

AfxNewCom (overload)

上一页返回章节概述下一页

Description

 

Creates a single uninitialized object of the class associated with a specified ProgID or CLSID.

 

FreeBASIC syntax

 

FUNCTION AfxNewCom OVERLOAD ( _

  BYREF wszProgID AS CONST WSTRING, _

  BYREF wszLicKey AS WSTRING = "" _

) AS ANY PTR

 

Parameters

 

wszProgID

[in] The ProgID or the CLSID of the object to create.

A ProgID such as "MSCAL.Calendar.7"

A CLSID such as "{8E27C92B-1264-101C-8A2F-040224009C02}"

wszLicKey

[in, optional] The license key as a unicode string.

 

Return value

 

The interface pointer or NULL.

 

Usage examples

 

DIM pDic AS IDictionary PTR

pDic = AfxNewCom("Scripting.Dictionary")

 

-or-

 

pDic = AfxNewCom(CLSID_Dictionary)

 

where CLSID_Dictionary has been declared as

CONST CLSID_Dictionary = "{EE09B103-97E0-11CF-978F-00A02463E06F}"

 

Include file

 

AfxCOM.inc