qse/ase/com/AwkExtio.cpp

79 lines
1.4 KiB
C++
Raw Normal View History

2006-12-09 11:50:08 +00:00
/*
2006-12-15 06:47:09 +00:00
* $Id: AwkExtio.cpp,v 1.7 2006-12-15 06:47:08 bacon Exp $
2006-12-09 11:50:08 +00:00
*/
#include "stdafx.h"
#include "ase.h"
#include "AwkExtio.h"
2006-12-09 17:36:27 +00:00
#include <stdio.h>
2006-12-09 11:50:08 +00:00
/////////////////////////////////////////////////////////////////////////////
// CAwkExtio
2006-12-15 06:47:09 +00:00
CAwkExtio::CAwkExtio (): name (NULL)
2006-12-09 11:50:08 +00:00
{
2006-12-15 06:47:09 +00:00
#ifdef _DEBUG
2006-12-09 17:36:27 +00:00
TCHAR x[128];
_sntprintf (x, 128, _T("CAwkExtio::CAwkExtio %p"), this);
MessageBox (NULL, x, x, MB_OK);
2006-12-15 06:47:09 +00:00
#endif
VariantInit (&handle);
2006-12-09 11:50:08 +00:00
}
CAwkExtio::~CAwkExtio ()
{
2006-12-15 06:47:09 +00:00
#ifdef _DEBUG
2006-12-09 17:36:27 +00:00
TCHAR x[128];
_sntprintf (x, 128, _T("CAwkExtio::~CAwkExtio %p"), this);
MessageBox (NULL, x, x, MB_OK);
2006-12-15 06:47:09 +00:00
#endif
2006-12-10 16:13:50 +00:00
if (name != NULL) SysFreeString (name);
2006-12-15 06:47:09 +00:00
VariantClear (&handle);
2006-12-09 11:50:08 +00:00
}
2006-12-10 16:13:50 +00:00
STDMETHODIMP CAwkExtio::get_Name (BSTR *pVal)
2006-12-09 11:50:08 +00:00
{
2006-12-10 16:13:50 +00:00
if (name == NULL) *pVal = name;
else
{
BSTR tmp = SysAllocStringLen (name, SysStringLen(name));
2006-12-15 06:47:09 +00:00
if (tmp == NULL) return E_OUTOFMEMORY;
2006-12-10 16:13:50 +00:00
*pVal = tmp;
}
2006-12-09 11:50:08 +00:00
return S_OK;
}
2006-12-10 16:13:50 +00:00
BOOL CAwkExtio::PutName (const TCHAR* val)
{
if (name != NULL) SysFreeString (name);
name = SysAllocString (val);
return (name == NULL)? FALSE: TRUE;
}
2006-12-09 11:50:08 +00:00
STDMETHODIMP CAwkExtio::get_Type(int *pVal)
{
*pVal = type;
return S_OK;
}
STDMETHODIMP CAwkExtio::get_Mode(int *pVal)
{
2006-12-10 16:13:50 +00:00
*pVal = mode;
2006-12-09 11:50:08 +00:00
return S_OK;
}
2006-12-11 14:58:25 +00:00
STDMETHODIMP CAwkExtio::get_Handle (VARIANT *pVal)
{
2006-12-15 06:47:09 +00:00
VariantClear (pVal);
2006-12-12 05:54:33 +00:00
VariantCopy (pVal, &handle);
2006-12-11 14:58:25 +00:00
return S_OK;
}
STDMETHODIMP CAwkExtio::put_Handle (VARIANT newVal)
{
2006-12-15 06:47:09 +00:00
VariantClear (&handle);
VariantCopy (&handle, &newVal);
2006-12-11 14:58:25 +00:00
return S_OK;
}