[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct tagPT_AIScale {
/// USHORT->unsigned short public ushort reading;
/// FLOAT->float public float MaxVolt;
/// USHORT->unsigned short public ushort MaxCount;
/// USHORT->unsigned short public ushort offset;
/// FLOAT* 最后这个应该是个指向viltage结构体类型的成员,不过你没给我这个东西信息,所以我只能用intptr指针替代了 public System.IntPtr voltage; }
希望这个有点用:[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct tagPT_AIScale {
/// USHORT->unsigned short public ushort reading;
/// FLOAT->float public float MaxVolt;
/// USHORT->unsigned short public ushort MaxCount;
/// USHORT->unsigned short public ushort offset;
/// FLOAT* public System.IntPtr voltage; }public partial class NativeMethods {
/// Return Type: int ///DriverHandle: int ///lpFAITransfer: tagPT_AIScale* [System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="DRV_FAITransfer")] public static extern int DRV_FAITransfer(int DriverHandle, ref tagPT_AIScale lpFAITransfer) ;}
tcmakebest 你好,voltage : ^Single; 这个会不会是一个浮点数的指针?
typedef struct tagPT_AIScale { USHORT reading; FLOAT MaxVolt; USHORT MaxCount; USHORT offset; FLOAT far *voltage; } PT_AIScale, FAR * LPT_AIScale; using namepsace System.Runtime.InteropServices;[StructLayoutAttribute(LayoutKind.Sequential)] internal struct tagPT_AIScale { public ushort reading; public float MaxVolt; public ushort MaxCount; public ushort offset; public IntPtr voltage; }
public struct tagPT_AIScale {
/// USHORT->unsigned short
public ushort reading;
/// FLOAT->float
public float MaxVolt;
/// USHORT->unsigned short
public ushort MaxCount;
/// USHORT->unsigned short
public ushort offset;
/// FLOAT* 最后这个应该是个指向viltage结构体类型的成员,不过你没给我这个东西信息,所以我只能用intptr指针替代了
public System.IntPtr voltage;
}
public struct tagPT_AIScale {
/// USHORT->unsigned short
public ushort reading;
/// FLOAT->float
public float MaxVolt;
/// USHORT->unsigned short
public ushort MaxCount;
/// USHORT->unsigned short
public ushort offset;
/// FLOAT*
public System.IntPtr voltage;
}public partial class NativeMethods {
/// Return Type: int
///DriverHandle: int
///lpFAITransfer: tagPT_AIScale*
[System.Runtime.InteropServices.DllImportAttribute("<Unknown>", EntryPoint="DRV_FAITransfer")]
public static extern int DRV_FAITransfer(int DriverHandle, ref tagPT_AIScale lpFAITransfer) ;}
tcmakebest 你好,voltage : ^Single; 这个会不会是一个浮点数的指针?
{
USHORT reading;
FLOAT MaxVolt;
USHORT MaxCount;
USHORT offset;
FLOAT far *voltage;
} PT_AIScale, FAR * LPT_AIScale;
using namepsace System.Runtime.InteropServices;[StructLayoutAttribute(LayoutKind.Sequential)]
internal struct tagPT_AIScale
{
public ushort reading;
public float MaxVolt;
public ushort MaxCount;
public ushort offset;
public IntPtr voltage;
}