Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/143.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++ 什么';在C+中使用Scripting.FileSystemObject时,导入之后的下一步是什么+;?_C++_Excel_Visual Studio 2010_Filesystemobject_Xlw - Fatal编程技术网

C++ 什么';在C+中使用Scripting.FileSystemObject时,导入之后的下一步是什么+;?

C++ 什么';在C+中使用Scripting.FileSystemObject时,导入之后的下一步是什么+;?,c++,excel,visual-studio-2010,filesystemobject,xlw,C++,Excel,Visual Studio 2010,Filesystemobject,Xlw,上下文:Windows7,XLW5.x,MicrosoftExcel2007,VisualStudio2010,C++ 给定以下代码位 #import "c:\windows\system32\scrrun.dll" raw_interfaces_only, \ raw_native_types, \ named_guids, \ rename("DeleteFile", "_DeleteFile"), \ rename("MoveFile","_MoveFile"), \ rename("Co

上下文:Windows7,XLW5.x,MicrosoftExcel2007,VisualStudio2010,C++

给定以下代码位

#import "c:\windows\system32\scrrun.dll" raw_interfaces_only, \
raw_native_types, \
named_guids, \
rename("DeleteFile", "_DeleteFile"), \
rename("MoveFile","_MoveFile"), \
rename("CopyFile", "_CopyFile"), \
rename("GetFreeSpace", "_GetFreeSpace")
using namespace Scripting;
现在如何实例化FileSystemObject并调用其方法?

这对我来说很有用

std::wstring fileExists(std::wstring name)
{
    VARIANT_BOOL b = 0;
    ::CoInitialize(NULL);
    {
        CComPtr<IFileSystem> spFSO;
        HRESULT hr = spFSO.CoCreateInstance(L"Scripting.FileSystemObject");
        if (SUCCEEDED(hr) && spFSO)
        {
            BSTR theName = SysAllocStringLen( name.data(), name.size());
            hr = spFSO->FileExists(theName, &b);
        }
    }
    ::CoUninitialize();
    return (b == -1) ? L"Exists" : L"Doesn't exist";
}
std::wstring文件存在(std::wstring名称)
{
变量b=0;
::协同初始化(空);
{
首席特别财务官;
HRESULT hr=spFSO.CoCreateInstance(L“Scripting.FileSystemObject”);
if(成功(hr)和spFSO)
{
BSTR theName=SysAllocStringLen(name.data(),name.size());
hr=spFSO->FileExists(名称,&b);
}
}
::coninitialize();
返回(b==-1)?L“存在”:L“不存在”;
}
这至少让我连接到了功能。在这种情况下,仍然有一些问题需要解决,但这超出了帖子的范围