本文整理汇总了C++中Attachment::saveToDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ Attachment::saveToDirectory方法的具体用法?C++ Attachment::saveToDirectory怎么用?C++ Attachment::saveToDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::saveToDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrepareAttachments
void AttachmentViewer::PrepareAttachments(){
if ( initialized == true ){
if ( fileWatchController != NULL ){
fileWatchController->pause = TRUE; //Needs work but this is to prevent me from getting into an infinite loop
}
Document doc = db.getDocument(_id, _rev);
wchar_t tempdir[MAX_PATH];
GetTempPath(MAX_PATH, tempdir);
StringCchCat(tempdir, MAX_PATH, L"cinch\\");
CreateDirectory(tempdir, NULL);
StringCchCat(tempdir, MAX_PATH, s2ws(_id).c_str());
CreateDirectory(tempdir, NULL);
string dir = ws2s(tempdir);
string idfile = dir + "\\.id";
string revfile = dir + "\\.rev";
SetFileAttributes(s2ws(idfile).c_str(), FILE_ATTRIBUTE_NORMAL);
SetFileAttributes(s2ws(revfile).c_str(), FILE_ATTRIBUTE_NORMAL);
FILE* f;
errno_t err = fopen_s(&f, idfile.c_str(), "w");
if (err == 0 ){
fwrite(_id.c_str(), sizeof(char), _id.length(), f);
fclose(f);
}
err = fopen_s(&f, revfile.c_str(), "w");
if ( err == 0 ){
fwrite(_rev.c_str(), sizeof(char), _rev.length(), f);
fclose(f);
}
SetFileAttributes(s2ws(idfile).c_str(), FILE_ATTRIBUTE_HIDDEN);
SetFileAttributes(s2ws(revfile).c_str(), FILE_ATTRIBUTE_HIDDEN);
try {
vector<Attachment> attachments = doc.getAllAttachments();
for(unsigned i=0; i<attachments.size(); i++){
Attachment a = attachments[i];
a.saveToDirectory(dir);
}
}catch(Exception e){
}
IShellItem *psi;
HRESULT hr = SHCreateItemFromParsingName(tempdir, 0, IID_PPV_ARGS(&psi));
if (SUCCEEDED(hr)){
HRESULT hr = _peb->BrowseToObject(psi, EBF_NONE);
}
if ( fileWatchController != NULL ){
fileWatchController->pause = FALSE;
}
WatchDirectory(s2ws(dir).c_str());
}
}