I need to call methods of the IWeatherStation interface which inherits IUnknown from C#. How do I go about it, if it is possible?
Thank you
I need to call methods of the IWeatherStation interface which inherits IUnknown from C#. How do I go about it, if it is possible?
Thank you
Sure. There is an example here: Example COM Class (C# Programming Guide).
The first thing you should do is locate the real (idl or c/c++) definition of the interface. For this SDK it's located for example in the <setup path>\Lockheed Martin\Prepar3D v4 SDK 4.3.29.25520\inc\PDK\IWeatherSystem.h
header file. This is where you will get the methods and the interface id (a.k.a. 'IID').
So in your case, it would be something like:
[Guid("e4452b96-16ba-4e82-9342-aa37af1f5c26")] // IID
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWeatherStationV430 // IUnknown base interface is implicit
{
bool IsValid();
float GetSurfaceWind();
void SetSurfaceWind(float aVal);
// etc...
}