Back to index

plt-scheme  4.2.1
testcontrol.cxx
Go to the documentation of this file.
00001 // TestControl.cpp : Implementation of CTestControl
00002 
00003 #include "stdafx.h"
00004 #include "Testobject.h"
00005 #include "TestControl.h"
00006 
00008 // CTestControl
00009 
00010 
00011 STDMETHODIMP CTestControl::AddTest(long n1, long *n2, long *n3)
00012 {
00013   // note side effect
00014   *n3 = n1 + *n2;
00015   *n2 = n1;
00016   return S_OK;
00017 }
00018 
00019 STDMETHODIMP CTestControl::StringTest (BSTR s1, BSTR s2, BSTR *s3)
00020 {
00021   int len1,len2;
00022 
00023   len1 = SysStringLen(s1);
00024   len2 = SysStringLen(s2);
00025 
00026   *s3 = SysAllocStringByteLen (NULL, (len1 + len2)*2);
00027   wcsncpy (*s3, s1, len1);
00028   wcsncpy (*s3 + len1, s2, len2);
00029 
00030   return S_OK;
00031 }
00032 
00033 STDMETHODIMP CTestControl::ShortTest (short n1, short n2, short *n3)
00034 {
00035   *n3 = n1 * n2;
00036   return S_OK;
00037 }
00038 
00039 STDMETHODIMP CTestControl::FloatTest (double n1, double n2, double *n3)
00040 {
00041   *n3 = n2 - n1;
00042   return S_OK;
00043 }
00044 
00045 STDMETHODIMP CTestControl::UnsignedTest (unsigned n1, unsigned n2, unsigned *n3)
00046 {
00047   *n3 = n2 - n1;
00048   return S_OK;
00049 }
00050 
00051 STDMETHODIMP CTestControl::get_Numprop (long ndx,long *pVal)
00052 {
00053   *pVal = the_value;
00054   return S_OK;
00055 }
00056 
00057 STDMETHODIMP CTestControl::put_Numprop (long ndx,long newVal)
00058 {
00059   the_value = (ndx > 21) ? 42 : 99;
00060   return S_OK;
00061 }