导航:  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 classID AS CONST CLSID, _

  BYREF riid AS CONST IID _

) AS ANY PTR

 

FUNCTION AfxNewCom OVERLOAD ( _

  BYREF wszClsID AS CONST WSTRING, _

  BYREF wszIID AS CONST WSTRING _

) AS ANY PTR

 

Parameters

 

classID

[in] The CLSID (class identifier) associated with the data and code that will be used to create the object.

wszClsID

[in] A CLSID in string format.

riid

[in] A reference to the identifier of the interface to be used to communicate with the object.

wszIID

[in] A reference to the identifier of the interface to be used to communicate with the object.

 

Return value

 

The interface pointer or NULL.

 

Usage example

 

DIM pDic AS IDictionary PTR

pDic = AfxNewCom(CLSID_Dictionary, IID_IDictionary)

 

where CLSID_Dictionary has been declared as

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

and IID_IDictionary as

CONST IID_IDictionary = "{42C642C1-97E1-11CF-978F-00A02463E06F}"

 

Include file

 

AfxCOM.inc