Bellingham Coder

The COM definition of IRunningObjectTable.Register is:
HRESULT Register( DWORD grfFlags,IUnknown * punkObject,IMoniker * pmkObjectName,DWORD * pdwRegister );

Where as the Managed definition of System.Runtime.InteropServices.ComTypes.IRunningObjectTable.Register is:

int Register (int grfFlags,Object punkObject,IMoniker pmkObjectName)

So my question is what happened to the pdwRegister pointer How are we supposed to know what to pass into the IRunningObjectTable.Revoke method if we can't get this value from the Register method

Thanks.



Re: Common Language Runtime Differences between COM and Managed IRunningObjectTable.Register method

Alois

The "old" deprecated interface System.Runtime.InteropServices.UCOMIRunningObjectTable.Register functions does return void. My guess is that you can simply use the returned integer from System.Runtime.InteropServices.ComTypes.IRunningObjectTable.Register to Revoke your interface later. You will not get the original HResult anyway because every non sucess HResult is transformed by the Marshaler into a COMException. This is the reason why the "old" interface does return void.Now you have the possibility to simply return the original out parameter and marshal it back as return value.

Yours,
Alois Kraus





Re: Common Language Runtime Differences between COM and Managed IRunningObjectTable.Register method

Bellingham Coder

That's what I was assuming too, but the value that was getting returned was 65536 which seemed like an odd registration ID value. In any case the msdn .NET documentation should be fixed to reflect what the return value actually represents.