|
|
|
start date: Fri, 17 Aug 2007 04:48:20 -0700,
posted on: microsoft.public.dotnet.framework.interop
back
| Thread Index |
|
1
Sundar
|
|
2
Mattias Sjgren
|
Com and .Net Interoperability problem
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 ?...
Date:Fri, 17 Aug 2007 04:48:20 -0700
Author:
|
Re: Com and .Net Interoperability problem
>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 Sjgren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Date:Fri, 17 Aug 2007 19:48:54 +0200
Author:
|
|
|