1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 //#include "AxTestComponents.h"
33 /////////////////////////////////////////////////////////////////////////////
35 CBasic::CBasic(): m_cPrpByte(0),m_nPrpShort(0),m_lPrpLong(0),m_fPrpFloat(0), m_dPrpDouble(0),m_PrpArray(0),
36 m_safearray(NULL
), m_bool(VARIANT_FALSE
),
37 m_arByte(0), m_arShort(0), m_arLong(0), m_arString(0), m_arVariant(0), m_arFloat(0),
38 m_arDouble(0), m_arObject(0), m_arByteDim2(0), m_date(0.), m_scode(0)
41 memset(&m_cy
, 0, sizeof(CY
));
42 memset(&m_decimal
, 0, sizeof(DECIMAL
));
47 SafeArrayDestroy(m_safearray
);
48 SafeArrayDestroy(m_arByte
);
49 SafeArrayDestroy(m_arShort
);
50 SafeArrayDestroy(m_arLong
);
51 SafeArrayDestroy(m_arString
);
52 SafeArrayDestroy(m_arVariant
);
53 SafeArrayDestroy(m_arFloat
);
54 SafeArrayDestroy(m_arDouble
);
55 SafeArrayDestroy(m_arObject
);
56 SafeArrayDestroy(m_arByteDim2
);
59 STDMETHODIMP
CBasic::inBool(VARIANT_BOOL val
)
64 STDMETHODIMP
CBasic::inByte(unsigned char val
)
70 STDMETHODIMP
CBasic::inShort(short val
)
76 STDMETHODIMP
CBasic::inLong(long val
)
82 STDMETHODIMP
CBasic::inString(BSTR val
)
88 STDMETHODIMP
CBasic::inFloat(float val
)
94 STDMETHODIMP
CBasic::inDouble(double val
)
99 CComVariant
varSource(val
);
100 HRESULT hr
= VariantChangeType(&varDest
, &varSource
, 0, VT_BSTR
);
104 STDMETHODIMP
CBasic::inVariant(VARIANT val
)
110 STDMETHODIMP
CBasic::inArray(LPSAFEARRAY val
)
113 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
115 if (FAILED(hr
= SafeArrayCopy(val
, &m_safearray
)))
120 STDMETHODIMP
CBasic::inObject(IDispatch
*val
)
126 STDMETHODIMP
CBasic::inoutBool(VARIANT_BOOL
* val
)
128 VARIANT_BOOL aBool
= *val
;
135 STDMETHODIMP
CBasic::inoutByte(unsigned char* val
)
137 unsigned char aByte
= *val
;
143 STDMETHODIMP
CBasic::inoutShort(short *val
)
151 STDMETHODIMP
CBasic::inoutLong(long *val
)
159 STDMETHODIMP
CBasic::inoutString(BSTR
*val
)
161 CComBSTR aStr
= *val
;
163 if (FAILED( hr
= m_bstr
.CopyTo(val
)))
169 STDMETHODIMP
CBasic::inoutFloat(float *val
)
177 STDMETHODIMP
CBasic::inoutDouble(double *val
)
179 double aDouble
= *val
;
185 STDMETHODIMP
CBasic::inoutVariant(VARIANT
*val
)
187 CComVariant aVar
= *val
;
189 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
195 /* The array contains VARIANT according to IDL.
196 If the VARIANTs contain strings then we append "out" to each string.
198 STDMETHODIMP
CBasic::inoutArray(LPSAFEARRAY
*val
)
200 SAFEARRAY
* aAr
= NULL
;
202 if (FAILED(hr
= SafeArrayCopy(*val
, &aAr
)))
204 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
206 if (FAILED(hr
= SafeArrayCopy(aAr
, & m_safearray
)))
211 STDMETHODIMP
CBasic::inoutObject(IDispatch
**val
)
213 CComPtr
<IDispatch
> disp
= *val
;
224 STDMETHODIMP
CBasic::outBool(VARIANT_BOOL
* val
)
230 STDMETHODIMP
CBasic::outByte(unsigned char *val
)
236 STDMETHODIMP
CBasic::outShort(short *val
)
242 STDMETHODIMP
CBasic::outLong(long *val
)
248 STDMETHODIMP
CBasic::outString(BSTR
*val
)
250 *val
= SysAllocString(m_bstr
);
254 STDMETHODIMP
CBasic::outFloat(float *val
)
260 STDMETHODIMP
CBasic::outDouble(double *val
)
266 STDMETHODIMP
CBasic::outVariant(VARIANT
*val
)
269 if (FAILED(hr
= VariantCopy(val
, &m_var1
)))
274 STDMETHODIMP
CBasic::outArray(LPSAFEARRAY
*val
)
277 if (FAILED(hr
= SafeArrayCopy(m_safearray
, val
)))
282 STDMETHODIMP
CBasic::outObject(IDispatch
* *val
)
292 STDMETHODIMP
CBasic::get_prpBool(VARIANT_BOOL
* pVal
)
294 if (!pVal
) return E_POINTER
;
299 STDMETHODIMP
CBasic::put_prpBool(VARIANT_BOOL val
)
306 STDMETHODIMP
CBasic::get_prpByte(unsigned char *pVal
)
314 STDMETHODIMP
CBasic::put_prpByte(unsigned char newVal
)
320 STDMETHODIMP
CBasic::get_prpShort(short *pVal
)
328 STDMETHODIMP
CBasic::put_prpShort(short newVal
)
334 STDMETHODIMP
CBasic::get_prpLong(long *pVal
)
342 STDMETHODIMP
CBasic::put_prpLong(long newVal
)
348 STDMETHODIMP
CBasic::get_prpString(BSTR
*pVal
)
352 m_bstrPrpString
.CopyTo( pVal
);
356 STDMETHODIMP
CBasic::put_prpString(BSTR newVal
)
358 m_bstrPrpString
= newVal
;
362 STDMETHODIMP
CBasic::get_prpFloat(float *pVal
)
370 STDMETHODIMP
CBasic::put_prpFloat(float newVal
)
376 STDMETHODIMP
CBasic::get_prpDouble(double *pVal
)
384 STDMETHODIMP
CBasic::put_prpDouble(double newVal
)
386 m_dPrpDouble
= newVal
;
390 STDMETHODIMP
CBasic::get_prpVariant(VARIANT
*pVal
)
395 if (FAILED(hr
= VariantCopy( pVal
, &m_PropVariant
)))
400 STDMETHODIMP
CBasic::put_prpVariant(VARIANT newVal
)
402 m_PropVariant
= newVal
;
406 STDMETHODIMP
CBasic::get_prpArray(LPSAFEARRAY
*pVal
)
411 if (FAILED(hr
= SafeArrayCopy( m_PrpArray
, pVal
)))
416 STDMETHODIMP
CBasic::put_prpArray(LPSAFEARRAY newVal
)
419 if (FAILED(hr
= SafeArrayDestroy( m_PrpArray
)))
421 if (FAILED(hr
= SafeArrayCopy( newVal
, &m_PrpArray
)))
426 STDMETHODIMP
CBasic::get_prpObject(IDispatch
**pVal
)
436 STDMETHODIMP
CBasic::put_prpObject(IDispatch
*newVal
)
442 STDMETHODIMP
CBasic::mixed1(
443 /* [out][in] */ unsigned char *aChar
,
444 /* [out][in] */ float *aFloat
,
445 /* [out][in] */ VARIANT
*aVar
)
460 STDMETHODIMP
CBasic::inSequenceLong(LPSAFEARRAY val
)
463 if (FAILED(hr
= SafeArrayDestroy(m_arLong
)))
465 if (FAILED(hr
= SafeArrayCopy(val
, & m_arLong
)))
470 STDMETHODIMP
CBasic::inSequenceByte( LPSAFEARRAY val
)
473 if (FAILED(hr
= SafeArrayDestroy(m_arByte
)))
475 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByte
)))
480 STDMETHODIMP
CBasic::inSequenceShort(LPSAFEARRAY val
)
483 if (FAILED(hr
= SafeArrayDestroy(m_arShort
)))
485 if (FAILED(hr
= SafeArrayCopy(val
, & m_arShort
)))
490 STDMETHODIMP
CBasic::inSequenceString(LPSAFEARRAY val
)
493 if (FAILED(hr
= SafeArrayDestroy(m_arString
)))
495 if (FAILED(hr
= SafeArrayCopy(val
, & m_arString
)))
500 STDMETHODIMP
CBasic::inSequenceFloat(LPSAFEARRAY val
)
503 if (FAILED(hr
= SafeArrayDestroy(m_arFloat
)))
505 if (FAILED(hr
= SafeArrayCopy(val
, & m_arFloat
)))
510 STDMETHODIMP
CBasic::inSequenceDouble(LPSAFEARRAY val
)
513 if (FAILED(hr
= SafeArrayDestroy(m_arDouble
)))
515 if (FAILED(hr
= SafeArrayCopy(val
, & m_arDouble
)))
520 STDMETHODIMP
CBasic::inSequenceObject(LPSAFEARRAY val
)
523 if (FAILED(hr
= SafeArrayDestroy(m_arObject
)))
525 if (FAILED(hr
= SafeArrayCopy(val
, & m_arObject
)))
530 void CBasic::printArray( LPSAFEARRAY val
, BSTR message
, VARTYPE type
)
537 hr
= SafeArrayGetLBound( val
, 1, &lbound
);
538 hr
= SafeArrayGetUBound( val
, 1, &ubound
);
539 long length
= ubound
- lbound
+1;
541 CComVariant varElement
;
543 sprintf( buf
,"%s", W2A(message
));
545 for( long i
= 0; i
< length
; i
++)
556 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
557 sprintf( tmp
, "%d \n", *(long*)&data
);
560 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
561 sprintf( tmp
, "%S \n", (BSTR
)data
);
564 hr
= SafeArrayGetElement( val
, &i
, &var
);
565 sprintf( tmp
, "%x \n", var
.byref
);
568 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
569 sprintf( tmp
, "%f \n", *(float*) &data
);
572 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
573 sprintf( tmp
, "%f \n", *(double*) &data
);
576 // we assume the objects are instances of this component and have the
577 // property prpString set.
578 hr
= SafeArrayGetElement( val
, &i
, (void*)&data
);
579 IDispatch
* pdisp
= ( IDispatch
*) data
;
580 CComDispatchDriver
driver( pdisp
);
584 driver
.GetPropertyByName(L
"prpString", &var
);
585 sprintf( tmp
, "%x : %S \n", *(long*)&data
, var
.bstrVal
);
588 sprintf( tmp
, "%x\n", *(long*)&data
);
593 MessageBox( NULL
, _T(A2T(buf
)), _T("AxTestComponents.Basic"), MB_OK
);
596 // V_ERROR OLECHAR VARIANT VT_UI1
598 STDMETHODIMP
CBasic::outSequenceByte(LPSAFEARRAY
* val
)
601 hr
= SafeArrayCopy(m_arByte
, val
);
605 STDMETHODIMP
CBasic::outSequenceShort(LPSAFEARRAY
* val
)
608 hr
= SafeArrayCopy(m_arShort
, val
);
612 STDMETHODIMP
CBasic::outSequenceLong(LPSAFEARRAY
* val
)
615 hr
= SafeArrayCopy(m_arLong
, val
);
619 STDMETHODIMP
CBasic::outSequenceString(LPSAFEARRAY
* val
)
622 hr
= SafeArrayCopy(m_arString
, val
);
626 STDMETHODIMP
CBasic::outSequenceFloat(LPSAFEARRAY
* val
)
629 hr
= SafeArrayCopy(m_arFloat
, val
);
633 STDMETHODIMP
CBasic::outSequenceDouble(LPSAFEARRAY
* val
)
636 hr
= SafeArrayCopy(m_arDouble
, val
);
640 STDMETHODIMP
CBasic::outSequenceObject(LPSAFEARRAY
* val
)
643 hr
= SafeArrayCopy(m_arObject
, val
);
647 STDMETHODIMP
CBasic::inoutSequenceByte(LPSAFEARRAY
* val
)
650 SAFEARRAY
*arTemp
= NULL
;
651 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
653 if (FAILED(hr
= SafeArrayCopy(m_arByte
, val
)))
659 STDMETHODIMP
CBasic::inoutSequenceShort(LPSAFEARRAY
* val
)
662 SAFEARRAY
*arTemp
= NULL
;
663 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
665 if (FAILED(hr
= SafeArrayCopy(m_arShort
, val
)))
671 STDMETHODIMP
CBasic::inoutSequenceLong(LPSAFEARRAY
* val
)
674 SAFEARRAY
*arTemp
= NULL
;
675 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
677 if (FAILED(hr
= SafeArrayCopy(m_arLong
, val
)))
683 STDMETHODIMP
CBasic::inoutSequenceString(LPSAFEARRAY
* val
)
686 SAFEARRAY
*arTemp
= NULL
;
687 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
689 if (FAILED(hr
= SafeArrayCopy(m_arString
, val
)))
695 STDMETHODIMP
CBasic::inoutSequenceFloat(LPSAFEARRAY
* val
)
698 SAFEARRAY
*arTemp
= NULL
;
699 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
701 if (FAILED(hr
= SafeArrayCopy(m_arFloat
, val
)))
707 STDMETHODIMP
CBasic::inoutSequenceDouble(LPSAFEARRAY
* val
)
710 SAFEARRAY
*arTemp
= NULL
;
711 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
713 if (FAILED(hr
= SafeArrayCopy(m_arDouble
, val
)))
719 STDMETHODIMP
CBasic::inoutSequenceObject(LPSAFEARRAY
* val
)
722 SAFEARRAY
*arTemp
= NULL
;
723 if (FAILED(hr
= SafeArrayCopy(*val
, &arTemp
)))
725 if (FAILED(hr
= SafeArrayCopy(m_arObject
, val
)))
731 // 2-dimensional Array
732 STDMETHODIMP
CBasic::inMulDimArrayLong(LPSAFEARRAY val
)
734 printMulArray( val
, VT_I4
);
737 // 2-dimensional Array
738 STDMETHODIMP
CBasic::inMulDimArrayVariant(LPSAFEARRAY val
)
740 printMulArray( val
, VT_VARIANT
);
743 // 3-dimensional Array
744 STDMETHODIMP
CBasic::inMulDimArrayLong2(LPSAFEARRAY val
)
746 printMulArray( val
, VT_I4
);
749 // 3-dimensional Array
750 STDMETHODIMP
CBasic::inMulDimArrayVariant2(LPSAFEARRAY val
)
756 STDMETHODIMP
CBasic::inMulDimArrayByte(LPSAFEARRAY val
)
759 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
761 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
765 // 3-dimensionales array
766 STDMETHODIMP
CBasic::inMulDimArrayByte2(LPSAFEARRAY val
)
769 // TODO: Add your implementation code here
770 //printMulArray( val, VT_UI1);
774 // supports 2 and 3 dimensionals SAFEARRAY with elements of long or VARIANT
775 void CBasic::printMulArray( SAFEARRAY
* val
, VARTYPE type
)
778 UINT dims
= SafeArrayGetDim( val
);
794 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
795 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
796 length1
= ubound1
- lbound1
+1;
798 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
799 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
800 length2
= ubound2
- lbound2
+ 1;
804 for( long i
= 0; i
< length2
; i
++)
806 for( long j
= 0; j
<length1
; j
++)
815 hr
= SafeArrayGetElement( val
, index
, &longVal
);
816 sprintf( tmpBuf
, "(%d,%d): %d\n", index
[1], index
[0], longVal
);
819 hr
= SafeArrayGetElement( val
, index
, &longVal
);
820 sprintf( tmpBuf
, "(%d,%d): %d\n", index
[1], index
[0], (unsigned char)longVal
);
823 hr
= SafeArrayGetElement( val
, index
, &var
);
824 sprintf( tmpBuf
, "(%d,%d): %d (vartype %d)\n", index
[1], index
[0], var
.byref
, var
.vt
);
827 strcat( buff
,tmpBuf
);
836 hr
= SafeArrayGetLBound( val
, 1, &lbound1
);
837 hr
= SafeArrayGetUBound( val
, 1, &ubound1
);
838 length1
= ubound1
- lbound1
+1;
840 hr
= SafeArrayGetLBound( val
, 2, &lbound2
);
841 hr
= SafeArrayGetUBound( val
, 2, &ubound2
);
842 length2
= ubound2
- lbound2
+ 1;
844 hr
= SafeArrayGetLBound( val
, 3, &lbound3
);
845 hr
= SafeArrayGetUBound( val
, 3, &ubound3
);
846 length3
= ubound3
- lbound3
+1;
850 for( long i
= 0; i
< length3
; i
++)
852 for( long j
= 0; j
<length2
; j
++)
854 for( long k
= 0; k
<length1
; k
++)
864 hr
= SafeArrayGetElement( val
, index
, &longVal
);
865 sprintf( tmpBuf
, "(%d,%d,%d): %d\n", index
[2], index
[1], index
[0], longVal
);
868 hr
= SafeArrayGetElement( val
, index
, &longVal
);
869 sprintf( tmpBuf
, "(%d,%d,%d): %d\n", index
[2], index
[1], index
[0], (unsigned char)longVal
);
873 hr
= SafeArrayGetElement( val
, index
, &var
);
874 sprintf( tmpBuf
, "(%d,%d,%d): %d (vartype %d)\n", index
[2], index
[1], index
[0], var
.byref
, var
.vt
);
877 strcat( buff
,tmpBuf
);
885 MessageBox( NULL
, A2T( buff
), _T("AxTestControl.Basic"), MB_OK
);
893 STDMETHODIMP
CBasic::outMore(long* val1
, long* val2
)
895 // TODO: Add your implementation code here
900 // If an optional parameter was not provided then the respective member will
902 STDMETHODIMP
CBasic::optional1(/*[in]*/ long val1
, /*[in, optional]*/ VARIANT
* val2
)
905 if (val2
->vt
!= VT_ERROR
)
910 STDMETHODIMP
CBasic::optional2(/*[out]*/ long* val1
,/*[out, optional]*/ VARIANT
* val2
)
915 if (val2
->vt
!= VT_ERROR
)
916 hr
= VariantCopy(val2
, & m_var1
);
920 STDMETHODIMP
CBasic::optional3(/*[in, optional]*/ VARIANT
* val1
,/*[in, optional]*/ VARIANT
* val2
)
922 //if (val1->vt != VT_ERROR)
925 //if (val2->vt != VT_ERROR)
930 STDMETHODIMP
CBasic::optional4(/*[in, out, optional]*/ VARIANT
* val1
,
931 /*[in, out, optional]*/ VARIANT
* val2
)
934 //return the previously set in values
935 if (val1
->vt
!= VT_ERROR
)
937 CComVariant
var1(*val1
);
938 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
942 if (val2
->vt
!= VT_ERROR
)
944 CComVariant
var2(*val2
);
945 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
952 STDMETHODIMP
CBasic::optional5(/*[out, optional]*/ VARIANT
* val1
,
953 /*[out, optional]*/ VARIANT
* val2
)
956 if (FAILED(hr
= VariantCopy(val1
, &m_var1
)))
958 if (FAILED(hr
= VariantCopy(val2
, &m_var2
)))
963 STDMETHODIMP
CBasic::defaultvalue1(/*[in, defaultvalue(10)]*/ long val1
,
964 /*[in, defaultvalue(3.14)]*/ double* val2
,
965 // /*[in, defaultvalue(10)]*/ VARIANT val3,
966 /*[in, defaultvalue(100)]*/ VARIANT
* val4
)
974 STDMETHODIMP
CBasic::defaultvalue2(/*[in, out, defaultvalue(10)]*/ long* val1
,
975 /*[in, out, defaultvalue(3.14)]*/ double* val2
,
976 // /*[in, out, defaultvalue(10)]*/ VARIANT* val3,
977 /*[in, out, defaultvalue(100)]*/ VARIANT
* val4
)
981 double aDouble
= *val2
;
982 // CComVariant var1(*val3);
983 CComVariant
var2(*val4
);
986 //if (FAILED(hr = VariantCopy(val3, &m_var1)))
988 if (FAILED(hr
= VariantCopy(val4
, &m_var2
)))
996 /* val2 contains the variable argument list. If no such arguments are supplied
997 then the safearray is invalid. SafeArrayCopy then returns E_INVALIDARG
999 STDMETHODIMP
CBasic::varargfunc1(/*[in]*/ long val1
,/*[in]*/ LPSAFEARRAY val2
)
1004 if (FAILED(hr
= SafeArrayDestroy(m_safearray
)))
1006 if (FAILED(hr
= SafeArrayCopy(val2
, & m_safearray
)))
1008 if (hr
!= E_INVALIDARG
)
1014 STDMETHODIMP
CBasic::varargfunc2(/*[out]*/ long* val1
, /*[out]*/ SAFEARRAY
** val2
)
1017 HRESULT hr
= SafeArrayCopy(m_safearray
, val2
);
1021 STDMETHODIMP
CBasic::inSequenceByteDim2(LPSAFEARRAY val
)
1024 if (FAILED(hr
= SafeArrayDestroy(m_arByteDim2
)))
1026 if (FAILED(hr
= SafeArrayCopy(val
, & m_arByteDim2
)))
1032 STDMETHODIMP
CBasic::inCurrency(CY val
)
1038 STDMETHODIMP
CBasic::outCurrency(CY
* val
)
1044 STDMETHODIMP
CBasic::inoutCurrency(CY
* val
)
1052 STDMETHODIMP
CBasic::inDate(DATE val
)
1058 STDMETHODIMP
CBasic::outDate(DATE
* val
)
1064 STDMETHODIMP
CBasic::inoutDate(DATE
* val
)
1072 STDMETHODIMP
CBasic::get_prpCurrency(CY
* pVal
)
1078 STDMETHODIMP
CBasic::put_prpCurrency(CY newVal
)
1084 STDMETHODIMP
CBasic::get_prpDate(DATE
* pVal
)
1090 STDMETHODIMP
CBasic::put_prpDate(DATE newVal
)
1096 //VT_I4 DECIMAL_NEG //tagVARIANT DISPATCH_PROPERTYPUT
1097 STDMETHODIMP
CBasic::inDecimal(DECIMAL val
)
1103 STDMETHODIMP
CBasic::outDecimal(DECIMAL
* val
)
1109 STDMETHODIMP
CBasic::inoutDecimal(DECIMAL
* val
)
1118 STDMETHODIMP
CBasic::get_prpDecimal(DECIMAL
* pVal
)
1124 STDMETHODIMP
CBasic::put_prpDecimal(DECIMAL newVal
)
1130 STDMETHODIMP
CBasic::inSCode(SCODE val
)
1136 STDMETHODIMP
CBasic::outScode(SCODE
* val
)
1142 STDMETHODIMP
CBasic::inoutSCode(SCODE
* val
)
1150 STDMETHODIMP
CBasic::get_prpSCode(SCODE
* pVal
)
1156 STDMETHODIMP
CBasic::put_prpSCode(SCODE newVal
)
1162 STDMETHODIMP
CBasic::inrefLong(LONG
* val
)
1168 STDMETHODIMP
CBasic::inrefVariant(VARIANT
* val
)
1171 if (FAILED(hr
= VariantCopy( & m_var1
, val
)))
1176 STDMETHODIMP
CBasic::inrefDecimal(DECIMAL
* val
)
1182 STDMETHODIMP
CBasic::get_prpRefLong(long* pVal
)
1188 STDMETHODIMP
CBasic::putref_prpRefLong(long* newVal
)
1194 STDMETHODIMP
CBasic::get_prprefVariant(VARIANT
* pVal
)
1197 hr
= VariantCopy(pVal
, & m_var1
);
1201 STDMETHODIMP
CBasic::putref_prprefVariant(VARIANT
* newVal
)
1207 STDMETHODIMP
CBasic::get_prprefDecimal(DECIMAL
* pVal
)
1213 STDMETHODIMP
CBasic::putref_prprefDecimal(DECIMAL
* newVal
)
1215 m_decimal
= *newVal
;
1220 STDMETHODIMP
CBasic::optional6(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1223 if (FAILED(hr
= m_var1
.Copy(val1
)))
1225 if (FAILED(hr
= m_var2
.Copy(val2
)))
1227 if (FAILED(hr
= m_var3
.Copy(val3
)))
1229 if (FAILED(hr
= m_var4
.Copy(val4
)))
1234 STDMETHODIMP
CBasic::optional7(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* val3
, VARIANT
* val4
)
1237 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1239 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1241 if (FAILED(hr
= VariantCopy(val3
, & m_var3
)))
1243 if (FAILED(hr
= VariantCopy(val4
, & m_var4
)))
1249 STDMETHODIMP
CBasic::get_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* pVal
)
1252 CComVariant
tmp1(*val1
);
1253 CComVariant
tmp2(*val2
);
1255 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1257 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1261 if (FAILED(hr
= VariantCopy(pVal
, & m_var3
)))
1266 STDMETHODIMP
CBasic::put_prpMultiArg1(VARIANT
* val1
, VARIANT
* val2
, VARIANT
* newVal
)
1269 CComVariant
tmp1( * val1
);
1270 CComVariant
tmp2( * val2
);
1272 if (FAILED(hr
= VariantCopy(val1
, & m_var1
)))
1274 if (FAILED(hr
= VariantCopy(val2
, & m_var2
)))
1283 // tagVARIANT DISPATCH_PROPERTYPUT DISPID_PROPERTYPUT VARIANTARG LOCALE_USER_DEFAULT
1285 STDMETHODIMP
CBasic::get_prpMultiArg2(VARIANT val1
, VARIANT
* pVal
)
1290 if (FAILED(hr
= VariantCopy(pVal
, & m_var2
)))
1295 STDMETHODIMP
CBasic::put_prpMultiArg2(VARIANT val1
, VARIANT newVal
)
1302 // returns the values set by prpMultiArg2
1303 STDMETHODIMP
CBasic::prpMultiArg2GetValues(VARIANT
* val1
, VARIANT
* valProperty
)
1306 if (FAILED(VariantCopy(val1
, & m_var1
)))
1308 if (FAILED(VariantCopy(valProperty
, & m_var2
)))
1313 STDMETHODIMP
CBasic::get_prpMultiArg3(LONG
* val1
, LONG
* pVal
)
1323 STDMETHODIMP
CBasic::put_prpMultiArg3(LONG
* val1
, LONG newVal
)
1333 STDMETHODIMP
CBasic::inUnknown(IUnknown
* val
)
1340 STDMETHODIMP
CBasic::outUnknown(IUnknown
** val
)
1342 m_unknown
.CopyTo(val
);
1346 STDMETHODIMP
CBasic::inoutUnknown(IUnknown
** val
)
1348 CComPtr
<IUnknown
> tmp
= *val
;
1349 m_unknown
.CopyTo(val
);
1354 STDMETHODIMP
CBasic::get_prpUnknown(IUnknown
** pVal
)
1356 m_prpUnknown
.CopyTo(pVal
);
1360 STDMETHODIMP
CBasic::put_prpUnknown(IUnknown
* newVal
)
1362 m_prpUnknown
= newVal
;