Added the DFCS_{HOT,TRANSPARENT} definitions.
[wine/gsoc_dplay.git] / dlls / oleaut32 / dispatch.c
blobc29f955d32e97d03904330ec78bebba08649751b
1 /**
2 * Dispatch API functions
4 * Copyright 2000 Francois Jacques, Macadamian Technologies Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * TODO: Type coercion is implemented in variant.c but not called yet.
23 #include "config.h"
25 #include <stdlib.h>
26 #include <string.h>
27 #include <stdio.h>
28 #include <ctype.h>
30 #include "windef.h"
31 #include "ole.h"
32 #include "oleauto.h"
33 #include "winerror.h"
34 #include "winreg.h" /* for HKEY_LOCAL_MACHINE */
35 #include "winnls.h" /* for PRIMARYLANGID */
37 #include "wine/obj_oleaut.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(ole);
42 WINE_DECLARE_DEBUG_CHANNEL(typelib);
45 /******************************************************************************
46 * DispInvoke (OLEAUT32.30)
49 * Calls method of an object through its IDispatch interface.
51 * NOTES
52 * - Defer method invocation to ITypeInfo::Invoke()
54 * RETURNS
56 * S_OK on success.
58 HRESULT WINAPI DispInvoke(
59 VOID *_this, /* [in] object instance */
60 ITypeInfo *ptinfo, /* [in] object's type info */
61 DISPID dispidMember, /* [in] member id */
62 USHORT wFlags, /* [in] kind of method call */
63 DISPPARAMS *pparams, /* [in] array of arguments */
64 VARIANT *pvarResult, /* [out] result of method call */
65 EXCEPINFO *pexcepinfo, /* [out] information about exception */
66 UINT *puArgErr) /* [out] index of bad argument(if any) */
68 HRESULT hr = E_FAIL;
70 /**
71 * TODO:
72 * For each param, call DispGetParam to perform type coercion
74 FIXME("Coercion of arguments not implemented\n");
76 hr = ICOM_CALL7(Invoke,
77 ptinfo,
78 _this,
79 dispidMember,
80 wFlags,
81 pparams, pvarResult, pexcepinfo, puArgErr);
83 return (hr);
87 /******************************************************************************
88 * DispGetIDsOfNames (OLEAUT32.29)
90 * Convert a set of names to dispids, based on information
91 * contained in object's type library.
93 * NOTES
94 * - Defers to ITypeInfo::GetIDsOfNames()
96 * RETURNS
98 * S_OK on success.
100 HRESULT WINAPI DispGetIDsOfNames(
101 ITypeInfo *ptinfo, /* [in] */
102 OLECHAR **rgszNames, /* [in] */
103 UINT cNames, /* [in] */
104 DISPID *rgdispid) /* [out] */
106 HRESULT hr = E_FAIL;
108 hr = ICOM_CALL3(GetIDsOfNames,
109 ptinfo,
110 rgszNames,
111 cNames,
112 rgdispid);
113 return (hr);
116 /******************************************************************************
117 * DispGetParam (OLEAUT32.28)
119 * Retrive a parameter from a DISPPARAMS structures and coerce it to
120 * specified variant type
122 * NOTES
123 * Coercion is done using system (0) locale.
125 * RETURNS
127 * S_OK on success.
129 HRESULT WINAPI DispGetParam(
130 DISPPARAMS *pdispparams, /* [in] */
131 UINT position, /* [in] */
132 VARTYPE vtTarg, /* [in] */
133 VARIANT *pvarResult, /* [out] */
134 UINT *puArgErr) /* [out] */
136 /* position is counted backwards */
137 UINT pos;
138 HRESULT hr;
140 TRACE("position=%d, cArgs=%d, cNamedArgs=%d\n",
141 position, pdispparams->cArgs, pdispparams->cNamedArgs);
142 if (position < pdispparams->cArgs) {
143 /* positional arg? */
144 pos = pdispparams->cArgs - position - 1;
145 } else {
146 /* FIXME: is this how to handle named args? */
147 for (pos=0; pos<pdispparams->cNamedArgs; pos++)
148 if (pdispparams->rgdispidNamedArgs[pos] == position) break;
150 if (pos==pdispparams->cNamedArgs)
151 return DISP_E_PARAMNOTFOUND;
153 hr = VariantChangeType(pvarResult,
154 &pdispparams->rgvarg[pos],
155 0, vtTarg);
156 if (hr == DISP_E_TYPEMISMATCH) *puArgErr = pos;
157 return hr;