|
|
1.1 root 1: /***
2: *CFPoint.cpp - The CPoint Class Factory.
3: *
4: * Copyright (C) 1992, Microsoft Corporation. All Rights Reserved.
5: * Information Contained Herein Is Proprietary and Confidential.
6: *
7: *Purpose:
8: * This module implements the CPoint class factory.
9: *
10: *Implementation Notes:
11: *
12: *****************************************************************************/
13:
14: #include <windows.h>
15: #include <ole2.h>
16: #include <dispatch.h>
17:
18: #include "spoly.h"
19: #include "cpoint.h"
20:
21:
22: CPointCF::CPointCF()
23: {
24: m_refs = 0;
25: }
26:
27:
28: CPointCF::~CPointCF()
29: {
30: }
31:
32:
33: IClassFactory FAR*
34: CPointCF::Create()
35: {
36: CPointCF FAR* pCF;
37:
38: if((pCF = new FAR CPointCF()) == NULL)
39: return NULL;
40: pCF->AddRef();
41: return pCF;
42: }
43:
44:
45: //---------------------------------------------------------------------
46: // IUnknown Methods
47: //---------------------------------------------------------------------
48:
49:
50: STDMETHODIMP
51: CPointCF::QueryInterface(REFIID riid, void FAR* FAR* ppv)
52: {
53: if(riid == IID_IUnknown || riid == IID_IClassFactory){
54: *ppv = this;
55: ++m_refs;
56: return NOERROR;
57: }
58: *ppv = NULL;
59: return ResultFromScode(E_NOINTERFACE);
60: }
61:
62: STDMETHODIMP_(ULONG)
63: CPointCF::AddRef(void)
64: {
65: return ++m_refs;
66: }
67:
68: STDMETHODIMP_(ULONG)
69: CPointCF::Release(void)
70: {
71: if(--m_refs == 0){
72: delete this;
73: return 0;
74: }
75: return m_refs;
76: }
77:
78:
79: //---------------------------------------------------------------------
80: // IClassFactory Methods
81: //---------------------------------------------------------------------
82:
83:
84: STDMETHODIMP
85: CPointCF::CreateInstance(
86: IUnknown FAR* pUnkOuter,
87: REFIID riid,
88: void FAR* FAR* ppv)
89: {
90: HRESULT hresult;
91: CPoint FAR *ppoint;
92:
93: if((ppoint = CPoint::Create()) == NULL){
94: *ppv = NULL;
95: return ResultFromScode(E_OUTOFMEMORY);
96: }
97: hresult = ppoint->QueryInterface(riid, ppv);
98: ppoint->Release();
99: return hresult;
100: }
101:
102:
103: STDMETHODIMP
104: CPointCF::LockServer(BOOL fLock)
105: {
106: return NOERROR;
107: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.