HRESULT FileExists (LPOLESTR oszFilename)
{ CComPtr<IFileSystem> pfs; HRESULT hr = pfs.CoCreateInstance(OLESTR("Scripting.FileSystemObject")); if (SUCCEEDED(hr)) { VARIANT_BOOL ret = VARIANT_FALSE; hr = pfs->raw_FileExists(fname, &ret); if (SUCCEEDED(hr)) hr = ret ? S_OK : S_FALSE; } return hr; } |