Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ COM方法调用返回灾难性失败_C++_Windows_Visual Studio 2008_Com - Fatal编程技术网

C++ COM方法调用返回灾难性失败

C++ COM方法调用返回灾难性失败,c++,windows,visual-studio-2008,com,C++,Windows,Visual Studio 2008,Com,注: 将BSTR变量传递给COM方法,HRESULT返回值为8000FFFF 以前使用接口指针进行的调用已成功:HRESULT为0 执行,Visual Studio内部成功,外部失败-发布和调试 说明: simFile看起来是存储在const char*中的单个字符 它不是以NULL结尾的字符串,除非它是空字符串且其内容为0。 你确定你不是有意做这样的事: const char *simFile = new char[1024]; strcpy(simFile, "path"); 更好的是,您

注:

将BSTR变量传递给COM方法,HRESULT返回值为8000FFFF 以前使用接口指针进行的调用已成功:HRESULT为0 执行,Visual Studio内部成功,外部失败-发布和调试 说明:


simFile看起来是存储在const char*中的单个字符

它不是以NULL结尾的字符串,除非它是空字符串且其内容为0。 你确定你不是有意做这样的事:

const char *simFile = new char[1024];
strcpy(simFile, "path");
更好的是,您可以直接使用SysAllocString来获取BSTR

BSTR str = SysAllocString(_T("path"));

simFile看起来是存储在const char*中的单个字符

它不是以NULL结尾的字符串,除非它是空字符串且其内容为0。 你确定你不是有意做这样的事:

const char *simFile = new char[1024];
strcpy(simFile, "path");
更好的是,您可以直接使用SysAllocString来获取BSTR

BSTR str = SysAllocString(_T("path"));