COM Interop

S

Sebastian Dau

Hello folks,.


I'm writing an OPC client based in the code project article:

http://www.codeproject.com/dotnet/opcdotnet.asp

GetItemProperties () member of IOPCItemProperties failes on execution.


IDL Signatur:

HRESULT GetItemProperties (
[in] LPWSTR szItemID,
[in] DWORD dwCount,
[in, size_is(dwCount)] DWORD * pdwPropertyIDs,
[out, size_is(,dwCount)] VARIANT ** ppvData,
[out, size_is(,dwCount)] HRESULT ** ppErrors
);

Diese wurde im obigen Beispiel umgewandelt in (C#):
[ComVisible(true), ComImport,
Guid("39c13a72-011e-11d0-9675-0020afd8adb3"),
InterfaceType( ComInterfaceType.InterfaceIsIUnknown )]
internal interface IOPCItemProperties
{
//......
[PreserveSig]
int GetItemProperties(
[In, MarshalAs(UnmanagedType.LPWStr) ] string szItemID,
[In] int dwCount,
[In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex=1)] int[]
pdwPropertyIDs,
[Out] out IntPtr ppvData,
[Out] out IntPtr ppErrors );
//...
}

Right after calling GetItemProperties () my OPC server (based in Northern
Dyn.) looses it's OPC items
and the adress space is empty.

Does anybody know how to handle this problem or whether or not this IDL - C#
conversion is corect?

Thanks for your help!

Sebastian Dau!
 

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