【问题标题】:Send a String parameter from VFP 9 to a dll created on c++ Visual Studio将字符串参数从 VFP 9 发送到在 c++ Visual Studio 上创建的 dll
【发布时间】: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


【解决方案1】:

尝试更改为... 这样您就试图强制将指针传递给字符串而不是字符串本身。它可能会为您解决。

DECLARE CamPhotoIn "CamCapture.dll" INTEGER, @STRING

testString = "TestVFP"
CamPhoto(0, @testString )

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-06
    相关资源
    最近更新 更多