Re: about casting
Hello again.
Now I get compile error when I do
CSession* Session = m_handle_DS->AccessSession(&pvSession, &bRes);
I get this compile error
The line above caused this copile error
C:\Projects\DTHTool\VSS\DTHToolObjects\AlterObj.cpp(3470) : error C2440:
'initializing' : cannot convert from 'long' to 'class ATL::CSession *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
Have you any good suggestion how to fix that.
I have defined this AccessSession according to you as you can see below.
SSTDMETHODIMP Handle_DS::AccessSession(void **ppvSession, VARIANT_BOOL
*bResult)
{
HRESULT hr S_OK;
*ppvSession = reinterpret_cast<LPVOID>(&Session);
return hr;
}
HRESULT CAlterObj::DBInitCommandTemplate(some parameter here)
{
void* pvSession = NULL;
CSession* Session = m_handle_DS->AccessSession(&pvSession, &bRes);
}
//Tony
Giovanni Dicanio" <giovanniDOTdicanio@REMOVEMEgmail.com> wrote in message
news:eKmEhZRWJHA.4896@TK2MSFTNGP02.phx.gbl...
"Tony Johansson" <t.johansson@logica.com> ha scritto nel messaggio
news:e2gIIQRWJHA.3912@TK2MSFTNGP06.phx.gbl...
Did you really test with void or LPVOID becuse I get compile error with
MIDL2139
meaning the following
MIDL2139: type of the parameter cannot derive from void or void*
MIDL is a strongly typed language. All parameters transmitted over the
network must be derived from one of the MIDL base types. MIDL does not
support void as a base type. You must change the declaration to a valid
MIDL type.
Did you derive the interface from IUnknown, or from IDispatch?
Is your COM interface a dual-interface?
I wrote in some previous message in this thread that void** is not an
automation-aware type.
The following compiles fine for me:
interface ISomeTest1 : IUnknown {
[helpstring("method AccessSomething"), local] HRESULT
AccessSomething([out] void ** ppvOpaque);
};
Giovanni