by Jan Huewel » Wed Apr 11, 2012 2:41 pm
Hi there,
as C# and VB .net are very similar languages the samples are all provided in the "easier" language VB net
However the main thing you will need to do is convert the dll declarations to C#
On more thing on Win7 64bit please make sure to set the build platform target to x86
Please see example code below
public partial class Form1 : Form
{
[System.Runtime.InteropServices.DllImport("PandorasAutomation.dll", EntryPoint = "AutoUnInitialize", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Ansi, SetLastError = true)]
public static extern void AutoUnInitialize();
[System.Runtime.InteropServices.DllImport("PandorasAutomation.dll", EntryPoint = "AutoInitialize", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Ansi, SetLastError = true)]
public static extern void AutoInitialize(string IP, Int32 Domain);
[System.Runtime.InteropServices.DllImport("PandorasAutomation.dll", EntryPoint = "AutoSetParamDouble", ExactSpelling = false, CharSet = System.Runtime.InteropServices.CharSet.Ansi, SetLastError = true)]
public static extern Boolean AutoSetParamDouble(Int32 SiteNum, Int32 DeviceNum, String ParamName, Double Value);
//(ByVal siteNum As Integer, ByVal deviceNum As Integer, ByVal ParamName As String, ByVal value As Double) As Boolean
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
AutoInitialize("127.0.0.1", 0);
}
private void trackBar1_ValueChanged(object sender, EventArgs e)
{
AutoSetParamDouble(2,1,"Opacity",trackBar1.Value) ;
}
}
Best regards
Jan Huewel