小弟手头有一活,底层都是vc开发的,现在用c#来调用
未曾研究过vc,初次调用出错,在线急等解决方案
vc方法签名如下LPRENGINE_API LPRRESULT __stdcall InitLPREngineParamHelper( LPREngineParam* pParam, int maxPlate, int minPlateW, int maxPlateW,
int chnRegion, LPRRatioRect recogRegion, int speed, bool bCapture, bool bAdaptiveFP, bool bEnableLowConfid );其中包含结构体struct LPREngineParam
{
int size;
LPRParam lprParam;
LPRRatioRect recogRegion; LPRRatioLine line1;
LPRRatioLine line2; int maxSkip;
float minValid;
float minConfid; int framePercent;
bool bAdaptiveFP;
int motionDetectionMode;
bool bCapture;
int minCaptureDiff;
LPRRatioRect preferCapRegion;
};
我在C#下是这样实现的
定了一结构体如下public struct LPREngineParam
{
public int size;
public LPRParam lprPrarm;
public LPRRatioRect recogRegion;
public LPRRatioLine line1;
public LPRRatioLine line2;
public int maxSkip;
public float minValid;
public float minConfid;
public int framePercent;
public bool bAdapticeFP;
public int motionDetectionMode;
public bool bCapture;
public int minCaptureDiff;
public LPRRatioRect preferCapRegion;
}
创建方法申明为 [DllImport("LPREngine.dll", CharSet = CharSet.Auto)]
public static extern long InitLPREngineParamHelper(LPREngineParam pParam,
int maxplate, int minPlateW, int maxPlateW, int chnRegion, LPRRatioRect recogRegion,
int speed, bool bCapture, bool bAdaptiveFP, bool bEnableLowConfid);
出现异常为对 PInvoke 函数“PCDLLTest!PCDLLTest.Form1::InitLPREngineParamHelper”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。不好意思没分送大家了
未曾研究过vc,初次调用出错,在线急等解决方案
vc方法签名如下LPRENGINE_API LPRRESULT __stdcall InitLPREngineParamHelper( LPREngineParam* pParam, int maxPlate, int minPlateW, int maxPlateW,
int chnRegion, LPRRatioRect recogRegion, int speed, bool bCapture, bool bAdaptiveFP, bool bEnableLowConfid );其中包含结构体struct LPREngineParam
{
int size;
LPRParam lprParam;
LPRRatioRect recogRegion; LPRRatioLine line1;
LPRRatioLine line2; int maxSkip;
float minValid;
float minConfid; int framePercent;
bool bAdaptiveFP;
int motionDetectionMode;
bool bCapture;
int minCaptureDiff;
LPRRatioRect preferCapRegion;
};
我在C#下是这样实现的
定了一结构体如下public struct LPREngineParam
{
public int size;
public LPRParam lprPrarm;
public LPRRatioRect recogRegion;
public LPRRatioLine line1;
public LPRRatioLine line2;
public int maxSkip;
public float minValid;
public float minConfid;
public int framePercent;
public bool bAdapticeFP;
public int motionDetectionMode;
public bool bCapture;
public int minCaptureDiff;
public LPRRatioRect preferCapRegion;
}
创建方法申明为 [DllImport("LPREngine.dll", CharSet = CharSet.Auto)]
public static extern long InitLPREngineParamHelper(LPREngineParam pParam,
int maxplate, int minPlateW, int maxPlateW, int chnRegion, LPRRatioRect recogRegion,
int speed, bool bCapture, bool bAdaptiveFP, bool bEnableLowConfid);
出现异常为对 PInvoke 函数“PCDLLTest!PCDLLTest.Form1::InitLPREngineParamHelper”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。不好意思没分送大家了
解决方案 »
- 想做实现一个监控显示功能,用TIMER每隔10秒显示变量的内容
- 右键菜单的问题!在线等解决方案
- 进程保护, 让Ntsd -c q -pn **.exe无法结束进程
- 低分求本C#网络编程方面的书
- windows应用程序如何转变为asp.net web应用程序
- C#能做嵌入式数据库开发么?WINFROM程序
- 在WinForm中,如何设置TreeView各级子节点的Checkbox
- 请问当我调用多线程System.Threading.Thread.Start方法。默认是多少个线程呢?我想调用更多的线程怎么做呢?
- 难题求解:如何获得某个文件的类型(ContentType)?谢谢!!! 例如:
- 如何调用其他页面文件中定义的类方法
- 我在自定义控件的时候, 一个控件里有包括文本框在内的很多种基本控件,运行显示总是文本框先出来,然后才是其他东西跟着出来,如何才能让它们同时出来?
- 这个问题怎么解决,关于子窗体问题的,请教。。。。。。。。。
{
public int size;
public LPRParam lprPrarm; // a pointer or a struct?
public LPRRatioRect recogRegion; // a pointer or a struct?
public LPRRatioLine line1;
public LPRRatioLine line2;
public int maxSkip;
public float minValid;
public float minConfid;
public int framePercent;
public bool bAdapticeFP;
public int motionDetectionMode;
public bool bCapture;
public int minCaptureDiff;
public LPRRatioRect preferCapRegion;
}2, another easy change you may try:
[DllImport("LPREngine.dll", CharSet = CharSet.Auto)]
public static extern long InitLPREngineParamHelper(ref LPREngineParam pParam, ...)According to C++ prototype, the first parameter must be a pointer, but LPREngineParam is a struct value.
忘记注明了LPRParam //structLPRRatioRect //struct