개요. | |||||||||||||||||||||||
COM 인스턴스 생성 함수. - 인자로 지정한 CLSID 에 해당하는 COM 개체 1개(초기화 되지 않은 상태) 생성한다. CoCreateInstance functionCreates a single uninitialized object of the class associated with a specified CLSID. Call CoCreateInstance when you want to create only one object on the local system. To create a single object on a remote system, call the CoCreateInstanceEx function. To create multiple objects based on a single CLSID, call the CoGetClassObject function. SyntaxC++ HRESULT CoCreateInstance( _In_ REFCLSID rclsid, _In_ LPUNKNOWN pUnkOuter, _In_ DWORD dwClsContext, _In_ REFIID riid, _Out_ LPVOID *ppv ); Parameters
Return valueThis function can return the following values.
RemarksThe CoCreateInstance function provides a convenient shortcut by connecting to the class object associated with the specified CLSID, creating an uninitialized instance, and releasing the class object. As such, it encapsulates the following functionality: CoGetClassObject(rclsid, dwClsContext, NULL, IID_IClassFactory, &pCF); hresult = pCF->CreateInstance(pUnkOuter, riid, ppvObj) pCF->Release(); It is convenient to use CoCreateInstance when you need to create only a single instance of an object on the local machine. If you are creating an instance on remote computer, call CoCreateInstanceEx. When you are creating multiple instances, it is more efficient to obtain a pointer to the class object's IClassFactory interface and use its methods as needed. In the latter case, you should use the CoGetClassObject function. In the CLSCTX enumeration, you can specify the type of server used to manage the object. The constants can be CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER or any combination of these values. The constant CLSCTX_ALL is defined as the combination of all four. For more information about the use of one or a combination of these constants, see CLSCTX. Requirements
See also | |||||||||||||||||||||||
|
///971.
'VisualStudio.C++.C# > 코딩팁,함수활용,단편' 카테고리의 다른 글
MFC. CDialogEx, CDialog (0) | 2016.09.22 |
---|---|
VC++. ActiveX 활용하기. 멤버변수 연결하기. ActiveX 컨트롤 컨테이너. (0) | 2016.09.20 |
C++ AMP. 예제 프로젝트들. (1) | 2016.09.14 |
C++ AMP. Math Libraries for C++ AMP (0) | 2016.09.14 |
COM. Component Object Model. PC 레지스트리에 등록/제거. regsvr32 명령어. (0) | 2016.07.30 |
댓글