【发布时间】:2014-09-01 16:03:43
【问题描述】:
我在 C++ Visual Studio 中使用 OpenCV 创建了一个 DLL 来捕获相机的图像。我收到参数字符串。
通常发送时我得到的是“声明 DLL 调用导致异常”,我不确定问题是我在 VFP 上发送的变量类型还是我在 C++ 上接收的类型。
DLL
extern "C"
{
__declspec(dllexport) void CamPhoto(int,String);
}
extern void __cdecl CamPhoto(int cam, string name)
{
char aux[100];
strcpy(aux, name.c_str());
CvCapture *capture = 0;
capture= cvCreateCameraCapture(cam);
IplImage *frame=0;
//SaveImage
char FileName[100];
char auxpath[100];
for(int i=0; i<2; i++){
frame = cvQueryFrame(capture);
sprintf(FileName,"/%s.jpg",aux);
strcpy(auxpath,"C:/Users/Emi/Pictures");
strcat(auxpath,FileName);
cvSaveImage(auxpath,frame);
}
cvReleaseCapture(&capture);
delete [] aux;
}
VFP
DECLARE CamPhotoIn "CamCapture.dll" INTEGER, STRING
CamPhoto(0, "TestVFP")
【问题讨论】:
-
什么是 VFP?你的问题是什么?
标签: c++ visual-studio-2010 opencv dll visual-foxpro