home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1999 September
/
CHIPCD_9_99.iso
/
software
/
uaktualnienia
/
OptionPackPL
/
iis4_07.cab
/
simple.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1998-04-27
|
2KB
|
74 lines
// Simple.cpp : Implementation of CSimple
#include "stdafx.h"
#include "CATLSmpl.h"
#include "Simple.h"
/////////////////////////////////////////////////////////////////////////////
//
// Created by the ATL 1.1 COM Wizard
STDMETHODIMP CSimple::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_ISimple,
};
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
//Ctor
CSimple::CSimple()
: m_bstrMyProperty(OLESTR("C++ ATL Simple Component"))
{}
//Put function for myProperty
STDMETHODIMP CSimple::put_myProperty(BSTR bstrInValue)
{
if (bstrInValue == NULL)
return E_POINTER;
m_bstrMyProperty = bstrInValue;
return S_OK;
}
//Get function for myProperty
STDMETHODIMP CSimple::get_myProperty(BSTR* pbstrOutValue)
{
if (pbstrOutValue == NULL)
return E_POINTER;
// Get Value from Property
*pbstrOutValue = m_bstrMyProperty.Copy();
return S_OK;
}
//Basic Method to convert a string to uppercase
STDMETHODIMP CSimple::myMethod(BSTR bstrIn, BSTR* pbstrOut)
{
if (bstrIn == NULL || pbstrOut == NULL)
return E_POINTER;
// Create a temporary CComBSTR
CComBSTR bstrTemp(bstrIn);
if (!bstrTemp)
return E_OUTOFMEMORY;
// Make string uppercase
wcsupr(bstrTemp);
// Return m_str member of bstrTemp
*pbstrOut = bstrTemp.Detach();
return S_OK;
}