Is my interpretation of COM interface correct?

R

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
 
M

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
 
R

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top