home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Windows Gam…ming Gurus (2nd Edition)
/
Disc2.iso
/
msdn_vcb
/
samples
/
vc98
/
atl
/
labrador
/
labobj.cpp
next >
Wrap
C/C++ Source or Header
|
1998-03-26
|
2KB
|
79 lines
// LabObj.cpp : Implementation of CLabradorApp and DLL registration.
//
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
#include "prelab.h"
#include "Labrador.h"
#include "LabObj.h"
#include <wchar.h>
/////////////////////////////////////////////////////////////////////////////
// CLabrador Interface Implementation
CLabrador::CLabrador()
{
wcscpy(m_szPetName, L"Fido");
wcscpy(m_szSpeciesName, L"Warthog");
m_bIsAlive = TRUE;
m_bIsBarking = FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// IDog Implementation
STDMETHODIMP CLabrador::GetPetName(MY_BSTR pStr)
{
if (pStr)
wcscpy(pStr, m_szPetName);
return (HRESULT)NOERROR;
}
STDMETHODIMP CLabrador::SetPetName(MY_BSTR pStr)
{
if (pStr)
{
wcscpy(m_szPetName, pStr);
return S_OK;
}
return E_POINTER;
}
STDMETHODIMP CLabrador::IsBarking(BOOL* pBool)
{
if (pBool)
{
*pBool = m_bIsBarking;
return S_OK;
}
return E_POINTER;
}
/////////////////////////////////////////////////////////////////////////////
// IMammal Implementation
STDMETHODIMP CLabrador::GetSpeciesName(MY_BSTR pStr)
{
if (pStr != NULL)
wcscpy(pStr, m_szSpeciesName);
return (HRESULT)NOERROR;
}
STDMETHODIMP CLabrador::IsAlive(BOOL* pBool)
{
if (pBool)
{
*pBool = m_bIsAlive;
return S_OK;
}
return E_POINTER;
}