Это старая версия документа!
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices; namespace scales_dll_csharp { class Program { // Load parameters from INI-file [DllImport("UniproScalesComServer.dll", CallingConvention = CallingConvention.StdCall)] public static extern int vr1(); // get weight from scales [DllImport("UniproScalesComServer.dll", CallingConvention = CallingConvention.StdCall)] public static extern int gw1(int p_scales, ref double p_weight, ref double p_price, ref double p_cost, ref int p_stab ); // send price [DllImport("UniproScalesComServer.dll", CallingConvention = CallingConvention.StdCall)] public static extern int pp1(int p_scales, int p_price); // press "T" [DllImport("UniproScalesComServer.dll", CallingConvention = CallingConvention.StdCall)] public static extern int pt1(int p_scales); static void Main(string[] args) { double lv_weight = 0; double lv_price = 0; double lv_cost = 0; int lv_stab = 0; int lv_res = 0; // Load parameters from INI-file vr1(); // send price lv_res = pp1(1, 12345); // get weight from scales number 1 lv_res = gw1( 1, ref lv_weight, ref lv_price, ref lv_cost, ref lv_stab); if (lv_res == 0) { Console.WriteLine("res={0:D} weight={1:F}; price={2:F}; cost={3:F}; stab={4:D}", lv_res, lv_weight, lv_price, lv_cost, lv_stab); } else { Console.WriteLine("Error={0:D}", lv_res); } // press T lv_res = pt1(1); Console.ReadLine(); } } }