[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Com and .Net Interoperability problem

Sundar

8/17/2007 11:48:00 AM

Hi I faced this Interoperability problem if any one have answers let
me know about it.

I developed the COM interface in VC++ as follows :


interface IModuleConfig
{
HRESULT SetValue(GUID guid, VARIANT* var);
}

class CModuleConfig : public IModuleConfig
{
};

HRESULT CModuleConfig :: SetValue(GUID guid, VARIANT* var)
{

if(var.vt == VT_BOOL)
{
m_bFound = var->boolVal;
}

return S_OK;
}




I converted it into aC# as follows :

[ComImport,Guid["Guid of IModuleConfig :"]
public interface IModuleConfig
{
int SetValue(Guid guid,Object obj);
}


m_pConfig = Activator.CreateInstance(CModuleConfig);
IModuleConfig m_pModuleConfig = m_pConfig as IModuleConfig;

m_pModuleConfig.SetValue( guid,true);

The "true" value is not properly send to the COM component Any one
have an idea about it ?...

1 Answer

(Mattias Sjögren)

8/17/2007 5:49:00 PM

0

>I converted it into aC# as follows :
>
> [ComImport,Guid["Guid of IModuleConfig :"]
> public interface IModuleConfig
> {
> int SetValue(Guid guid,Object obj);

Try it like this

void SetValue(Guid guid, ref Object obj);


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.n... | http://www.dotneti...
Please reply only to the newsgroup.