namespace WpfApplication1
{
public partial class MainWindow : Window
{
[ComImport,
Guid("2B4AD756-C379-4BAB-9804-72E9A9E0B26F"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITest
{
[MethodImplAttribute(MethodImplOptions.PreserveSig)]
[return: MarshalAs(UnmanagedType.U1)]
void SetTest(int value);
[MethodImplAttribute(MethodImplOptions.PreserveSig)]
[return: MarshalAs(UnmanagedType.U1)]
int GetTest();
}
public abstract class TTest : ITest
{
public abstract void SetTest(int value);
public abstract int GetTest();
}
[DllImport("Schnittstellen_1.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)]
public static extern TTest GetTest();
public MainWindow()
{
InitializeComponent();
}
private void Window_Initialized(object sender, EventArgs e)
{
GetTest().SetTest(2);
MessageBox.Show(GetTest().GetTest().ToString());
}
}
}