1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 // Simple.cpp : Implementation of CSimple
24 #include "stdafx.h"
25 #include "XCallback_Impl.h"
26 #include "Simple.h"
27 
28 /////////////////////////////////////////////////////////////////////////////
29 // CSimple
30 
31 
func(BSTR message)32 STDMETHODIMP CSimple::func(BSTR message)
33 {
34 	USES_CONVERSION;
35 	MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
36 	return S_OK;
37 }
38 
39 
func2(BSTR message)40 STDMETHODIMP CSimple::func2(BSTR message)
41 {
42 	USES_CONVERSION;
43 	MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
44 	return S_OK;
45 }
46 
func3(BSTR message)47 STDMETHODIMP CSimple::func3(BSTR message)
48 {
49 	USES_CONVERSION;
50 	MessageBox( NULL, W2T( message), _T("XCallback_Impl.Simple"), MB_OK);
51 	return S_OK;
52 }
53 
54 
get__implementedInterfaces(LPSAFEARRAY * pVal)55 STDMETHODIMP CSimple::get__implementedInterfaces(LPSAFEARRAY *pVal)
56 {
57 	HRESULT hr= S_OK;
58 	SAFEARRAY *pArr=	SafeArrayCreateVector( VT_BSTR, 0, 3);
59 	if( pArr)
60 	{	long index=0;
61 		BSTR name1= SysAllocString(L"oletest.XSimple");
62 		BSTR name2= SysAllocString(L"oletest.XSimple2");
63 		BSTR name3= SysAllocString(L"oletest.XSimple3");
64 
65 		hr= SafeArrayPutElement( pArr, & index, name1);
66 		index++;
67 		hr= SafeArrayPutElement( pArr, &index, name2);
68 		index++;
69 		hr= SafeArrayPutElement( pArr, &index, name3);
70 		*pVal= pArr;
71 
72 	}
73 	*pVal= pArr;
74 	return S_OK;
75 }
76 
77