Home All Groups Group Topic Archive Search About

Is my interpretation of COM interface correct?

Author
17 Nov 2006 12:59 PM
Robinson
I'm trying to wrap the COM interface IClientVirtualDevice.  Is my
interpretation of the functions within it correct (GetCommand and
CompleteCommand)?




''' <summary>
''' Wrapper for IClientVirtualDevice
''' </summary>
<ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown),
Guid("40700424-0080-11D2-851F-00C04FC21759")> _
Public Interface IClientVirtualDevice




    ' virtual HRESULT STDMETHODCALLTYPE GetCommand(
    ' /* [in] */ DWORD dwTimeOut,
    ' /* [out] */ struct VDC_Command **ppCmd) = 0;

    Function GetCommand(ByVal dwTimeOut As Integer, _
                                        ByRef ppCmd As VDC_Command) As
Integer




    ' virtual HRESULT STDMETHODCALLTYPE CompleteCommand(
    ' /* [in] */ struct VDC_Command *pCmd,
    ' /* [in] */ DWORD dwCompletionCode,
    ' /* [in] */ DWORD dwBytesTransferred,
    ' /* [in] */ DWORDLONG dwlPosition) = 0;


    Function CompleteCommand(ByVal pCmd As VDC_Command, _
                                        ByVal dwCompletionCode As Integer, _
                                        ByVal dwBytesTransferred As Integer,
_
                                        ByVal dwlPosition As Long) As
Integer

End Interface

Author
17 Nov 2006 9:08 PM
Mattias Sjögren
>I'm trying to wrap the COM interface IClientVirtualDevice.  Is my
>interpretation of the functions within it correct (GetCommand and
>CompleteCommand)?

The Functions should be Subs unless you add the <PreserveSig>
attribute and handle the HRESULT return codes yourself.

I'd have to see your declaration of VDC_Command to know it the
parameter types are correct. But I'm guessing that it should be ByRef
pCmd As VCD_Command and ByRef ppCmd As IntPtr.



Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Author
18 Nov 2006 10:50 AM
Robinson
> I'd have to see your declaration of VDC_Command to know it the
> parameter types are correct. But I'm guessing that it should be ByRef
> pCmd As VCD_Command and ByRef ppCmd As IntPtr.
>

Thanks for your help.  I'm trying to wrap the entire VDI interface for use
with .NET - if it's already available somewhere, I would appreciate someone
linking to it ;).

Anyway:


Public Structure VDC_Command
    Public commandCode As Integer
    Public size As Integer
    Public position As Long
    Public buffer() As Byte
End Structure