컴퓨터 공부/번역

COM관련 공부

려리군 2009. 6. 4. 01:25

Component Object Model(COM)

참고주소 : http://msdn.microsoft.com/en-us/library/ms680573(VS.85).aspx

목적

COM은 상호작용할 수 있는 이진 소프트웨어 컴포넌트에 대한 플랫폼 독립, 분산, 객체 지향 시스템이다.

COM은 마이크로소프트 OLE(복합 문서)와 ActiveX(인터넷에서 가능한 컴포넌트) 기술에 대한 기초(foundation) 기술이다.

어디나 적용 가능

COM 객체는 다양한 프로그래밍 언어로 제작될 수 있다. C++같은 객체 지향 언어는 COM 객체를 구현을 간단하게 하는 프로그래밍 메카니즘을 제공한다.

이러한 객체들은 하나의 프로세스, 다른 프로세스, 심지어 다른(remote) 컴퓨터에도 있을 수 있다.




IClassFactory Interface

참고주소 : http://msdn.microsoft.com/en-us/library/ms694364.aspx

Enables a class of objects to be created.

생성될 객체의 클래스를 사용가능하게 한다.


When To Implement

언제 구현하는가


You must implement this interface for every class that you register in the system registry and to which you assign a CLSID, so objects of that class can be created.

시스템 레지스트리에 당신이 지정한 CLSID로 당신이 등록한 모든 클래스에 대해 이 인터페이스를 구현해야 하며 그럼으로서 그 클래스의 객체들이 생성될 수 있다.


When To Use

언제 사용하는가?


After calling the CoGetClassObject function to get an IClassFactory interface pointer to the class object, call the CreateInstance method of this interface to create a new uninitialized object.

클래스 객체의 IClassFactory 인터페이스 포인터를 얻기 위해 CoGetClassObject 함수를 호출한 후 초기화되지 않은 새로운 객체를 생성하기 위해 이 인터페이스의 CreateInstance를 호출한다.

It is not, however, always necessary to go through this process to create an object. To create a single uninitialized object, you can, instead, just call CoCreateInstance. OLE also provides numerous helper functions (with names of the form OleCreateXxx) to create compound document objects.

그러나 객체를 생성하기 위한 이 과정이 항상 필요한 것은 아니다. 하나의 초기화되지 않는 객체를 생성하기 위해 CoCreateInstance를 대신 호출 할 수 있다. OLE는 또한 복합 문서 객체들을 생성하기 위해 (OleCreatXXX형태의 이름으로) 다양한 도우미 함수들을 제공한다.

Call the LockServer method to keep the object server in memory and enhance performance only if you intend to create more than one object of the specified class.

특정 클래스의 하나의 객체 이상을 생성할 준비가 되었다면 수행 향상시키고 메모리의 객체 서버를 유지하기 위해 LockServer 함수를 호출한다.


Methods(메소드)

The IClassFactory interface inherits the methods of the IUnknown interface.

IClassFactory 인터페이스는 IUnknown 인터페이스의 메소드들을 상속받는다.

In addition, IClassFactory defines the following methods.

게다가 IClassFactory는 다음 메소드들을 정의해야 한다.


Method Description(메소드 설명)

CreateInstance 

Creates an uninitialized object.

초기화되지 않은 객체를 생성한다.

LockServer

Locks an object application open in memory.

메모리 상에 열려있는 객체 응용 프로그램을 잠근다.




참고주소 : http://msdn.microsoft.com/en-us/library/ms686615(VS.85).aspx

The 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. 

CoCreateInstance 함수는 특정 CLSID와 연관된 클래스 객체를 연결하고 초기화되지 않은 인스턴스를 생성하고 클래스 객체를 해제함으로써 편리한 바로가기(지름길)를 제공한다.

As such, it encapsulates the following functionality:

다음 기능을 포함(encapsulate)하고 있다.


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. 

현재 내가 사용하는 컴퓨터에서 객체에 대한 하나의 인스턴스만 생성할 필요가 있을 때 CoCreateInstance를 사용하면 편리하다.

If you are creating an instance on remote computer, call CoCreateInstanceEx. 

네트워크상 다른 컴퓨터에서 인스턴스를 생성하고 싶다면 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.

여러 인스턴스들을 생성할 때 클래스 객체의 IClassFactory 인터페이스의 포인터를 얻고 필요할 때 그 메소드를 사용하는 것이 더 효율적이다. 후자의 경우 CoGetClassObject 함수를 사용해야 한다.

In the CLSCTX enumeration, you can specify the type of server used to manage the object.

CLSCTX enumeration은 객체를 관리하는 데 사용되는 서버의 형태를 정할 수 있다.

The constants can be CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, CLSCTX_LOCAL_SERVER, or any combination of these values. 

상수들은 CLSCTX_INPROC_SERVER, CLSCTX_INPROC_HANDLER, CLSCTX_LOCAL_SERVER나 이 값들의 조합이 될 수 있다.

The constant CLSCTX_ALL is defined as the combination of all three. 

CLSCTX_ALL 상수는 이 세가지의 조합으로 정의된다. 

For more information about the use of one or a combination of these constants, see CLSCTX.

이 상수에 대한 조합에 대한 사용법에 관한 정보는 CLSCTX를 봐라.


CLSCTX : http://msdn.microsoft.com/en-us/library/ms693716(VS.85).aspx



'컴퓨터 공부 > 번역' 카테고리의 다른 글

균형 이진 탐색 트리  (0) 2009.07.02
stub, marshalling, serialization  (0) 2009.06.04
INADDR_ANY  (0) 2009.05.25
7. XML 검증  (0) 2009.05.13
6. XML 속성  (0) 2009.05.13