C#调用C++封装的dll,函数执行成功了,设备没有执行指令,求大神指教问题在哪
南天空 2016-03-11 03:52:21 C#中关键代码如下:
public class ControlFunction
{
[DllImport("DCS_APP1.dll", EntryPoint = @"Leds",CallingConvention=CallingConvention.StdCall)]
public static extern int Leds(int console,int gate,int unit,int status,int value);//控制Led灯
}
public static void LedOn()
{
int result = ControlFunction.Leds(0,0,0,1,0x004);
if (result==-3040)
{
MessageBox.Show("状态错误!");
}
}
Leds()函数的正确的返回值是0,函数在C#写的测试程序中能正常调用,返回值也是0 ,但是控制的设备led没有跟着变化。请问是哪块的问题。
函数的原型是 int PASCAL EXPORT Leds(int console,int gate,int unit,int status,int value)