I have made an ATL interface that return a value as a [out,retval] and
another one as a [out] only. I have no problem with the retval Variant
but I have a problem getting back the [out] value in VisualFoxPro. I
simplify the problem down this next example.
Ex:
ATL C++ 5.0(sp3)
-----------------------------------------
interface ITest : IDispatch
{
[id(1), helpstring("method TestOut")] HRESULT TestOut([out] VARIANTARG
*pOutVal, [out,retval] VARIANTARG *pRetVal);
};
STDMETHODIMP CTest::TestOut(VARIANTARG *pOutVal, VARIANTARG *pRetVal)
{
VARIANT var;
VariantInit(&var);
VariantInit(pRetVal);
VariantInit(pOutVal);
var.vt = VT_I4;
var.lVal = 50;
VariantCopy(pOutVal, &var);
VariantCopy(pRetVal, &var);
VariantClear(&var);
return S_OK;
}
--------------------------------------------
Works fine in VB 5.0(sp3)
Dim testobj as new Test
Dim vout as Variant
Dim vret as Variant
vret = testobj.TestOut(vout)
Debug.Print vout
Debug.Print vret
OK both vout & vret value are 50
---------------------------------------------------
But in FoxPro 5.0(sp3)
testobj = CreateObject("Test")
vout = 0
vret = testobj.TestOut(@vout)
? vret ---> OK == 50
? vout ----> ERROR == 0
I've tried vret = testobj.testOut(vout) without the @ but it's the samething
Thank you in advance
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement