|
| COM wrapper data type |
|
|
|
|
| Messages |
|
Related Types |
This message was discovered on microsoft.public.dotnet.framework.
| Joe Kinsella |
I'm trying to write a COM wrapper for a COM object for which I do not have a header file but not a type library. Specifically, I am using NetCon.h to construct a COM wrapper to give me access to interfaces such as INetConnectionManager and INetConnection. I have two questions:
1) How can I determine the index of the DispId of the to use for the methods of the COM object? 2) I have a method that has an out parameter of type pointer to a pointer to a COM interface (IEnumNetConnection ** ppEnum). I'm a little unsure as to how or if this can be translated to a .Net COM wrapper?
Any help would be appreciated.
Joe
|
|
|
| |
|
| |
| |
| Mattias Sjögren |
Joe,
[Original message clipped]
These interfaces are derived directly from IUnknown, not dispatch interfaces, so no DISPIDs are involved.
[Original message clipped]
void EnumConnections(NETCONMGR_ENUM_FLAGS Flags, out IEnumNetConnection ppEnum);
or more conveniently
IEnumNetConnection EnumConnections(NETCONMGR_ENUM_FLAGS Flags);
Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
|
|
|
| |
|
| |
| |
| Joe Kinsella |
Thanks for the reply. So does:
MIDL_INTERFACE("ba126ad1-2166-11d1-b1d0-00805fc1270e")
INetConnectionManager : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE EnumConnections(
/* [in] */ NETCONMGR_ENUM_FLAGS Flags,
/* [out] */ IEnumNetConnection **ppEnum) = 0;
};
....become...
[ComImport]
[Guid("ba126ad1-2166-11d1-b1d0-00805fc1270e")]
[ClassInterface(ClassInterfaceType.None)]
[TypeLibType(TypeLibTypeFlags.FCanCreate)]
public class INetConnectionManager
{
[MethodImpl(MethodImplOptions.InternalCall,
MethodCodeType=MethodCodeType.Runtime)]
public extern IntPtr EnumConnections( NETCONMGR_ENUM_FLAGS Flags, ref IEnumNetConnection ppEnum);
}
Addition help is very much appreciated. Thanks again.
|
|
|
| |
|
|
| |
| |
| Mattias Sjögren |
Joe,
Why do you declare it as a class? I'd make it an interface.
[ComImport] [Guid("ba126ad1-2166-11d1-b1d0-00805fc1270e")] [ComInterface(ComInterfaceType.InterfaceIsIUnknown)] interface INetConnectionManager { void EnumConnections(NETCONMGR_ENUM_FLAGS Flags, out IEnumNetConnection ppEnum); }
Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
|
|
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
BootFX
Reliable and powerful .NET application framework. |
|
|
|
|
|
|