本文整理汇总了C++中GetFolder函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFolder函数的具体用法?C++ GetFolder怎么用?C++ GetFolder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFolder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnAddNew
void CWSFCHomeListCtrl::OnAddNew (void)
{
// Get WSF/C Home Path
CString sPath;
if (FALSE == GetFolder (&sPath, "Find WSF/C Home Location.", this->m_hWnd, NULL, NULL))
return;
// Validate Path
if (true == sPath.IsEmpty ())
return;
CString sAxis2XMLFile = sPath;
if (sAxis2XMLFile[sAxis2XMLFile.GetLength () - 1] != '\\')
sAxis2XMLFile+= "\\";
sAxis2XMLFile+= "axis2.xml";
CFile oAxis2XMLFile;
if (FALSE == oAxis2XMLFile.Open (sAxis2XMLFile, CFile::modeRead | CFile::shareDenyNone))
{
CString sMessage = "\"";
sMessage+= sPath;
sMessage+= "\" is not a valid WSF/C home !!!";
AfxMessageBox (sMessage, MB_ICONEXCLAMATION | MB_OK);
return;
}
// Add Path to List Ctrl
InsertItem (GetItemCount (), sPath);
}
示例2: GetEditControl
void CFileBrowserListCtrl::OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
CEdit *pEdit = GetEditControl();
if (m_LabelEdit && pEdit != NULL) { // if label edit wasn't canceled
CString NewName;
pEdit->GetWindowText(NewName); // label is new item name
int ItemIdx = pDispInfo->item.iItem;
CDirItem& item = m_DirList.GetItem(ItemIdx);
if (NewName != item.GetName()) { // if name is different
CPathStr NewPath(GetFolder());
NewPath.Append(NewName); // make new item path
CString OldPath(GetItemPath(ItemIdx));
if (RenameFile(m_hWnd, OldPath, NewPath)) {
item.SetName(NewName); // update item name
NMFBRENAMEITEM nmri;
nmri.pszOldPath = OldPath;
nmri.pszNewPath = NewPath;
Notify(FBLCN_RENAMEITEM, &nmri);
}
}
}
m_LabelEdit = FALSE;
*pResult = 0;
}
示例3: FindAnimeItem
void FolderMonitor::OnFile(const DirectoryChangeNotification& notification) const {
anime::Episode episode;
auto anime_item = FindAnimeItem(notification, episode);
if (!anime_item)
return;
if (!Meow.IsValidAnimeType(episode) || !Meow.IsValidFileExtension(episode))
return;
bool path_available = notification.action != FILE_ACTION_REMOVED;
// Set anime folder
if (path_available && anime_item->GetFolder().empty()) {
ChangeAnimeFolder(*anime_item, episode.folder);
}
// Set episode availability
int lower_bound = anime::GetEpisodeLow(episode);
int upper_bound = anime::GetEpisodeHigh(episode);
std::wstring path = notification.path + notification.filename.first;
for (int number = lower_bound; number <= upper_bound; ++number) {
if (anime_item->SetEpisodeAvailability(number, path_available, path)) {
LOG(LevelDebug, anime_item->GetTitle() + L" #" + ToWstr(number) + L" is " +
(path_available ? L"available." : L"unavailable."));
}
}
}
示例4: GetFolder
int CmFile::GetNames(CStr &nameW, vecS &names)
{
string dir = GetFolder(nameW);
names.clear();
names.reserve(6000);
DIR *dp = opendir(_S(dir));
if (dp == NULL){
cout << dir << endl;
perror("Cannot open directory");
return EXIT_FAILURE;
}
struct dirent *dirContent;
while ((dirContent = readdir(dp)) != NULL){
if (string(dirContent->d_name)[0] == '.')
continue;
struct stat st;
lstat(dirContent->d_name,&st);
if(S_ISREG(st.st_mode)){
cout << string(dirContent->d_name) << " " << st.st_mode << endl;
names.push_back(string(dirContent->d_name));
}
}
closedir(dp);
return (int)names.size();
}
示例5: GetFolder
void COutlook2Ctrl::OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler)
{
if (m_iSelectedFolder < 0) return;
COL2Folder * oFolder = GetFolder(m_iSelectedFolder);
for (int i = 0; i < oFolder->m_Items.GetSize(); i++)
{
COL2Item * pi = (COL2Item *) oFolder->m_Items.GetAt(i);
for (int s = 0; s < pi->m_SubItems.GetSize(); s++)
{
COL2SubItem * ps = (COL2SubItem *) pi->m_SubItems.GetAt(s);
if (ps->dwStyle == OCL_SELECT || ps->dwStyle == OCL_RADIO || ps->dwStyle == OCL_CHECK)
{
COL2CCmdUI pui;
pui.pSI = ps;
pui.m_nID = ps->lParam;
GetOwner()->OnCmdMsg(pui.m_nID, CN_UPDATE_COMMAND_UI, &pui, NULL);
if (pui.iRes != ps->iLastStatus && !ps->rcItem.IsRectEmpty())
{
InvalidateRect(ps->rcItem);
}
}
}
}
/* iLastStatus = pui.iRes;
TRACE1("%d\n", (int) GetTickCount());
CToolBar b;
b.OnUpdateCmdUI(*/
}
示例6: path
void CFileBrowserListCtrl::OpenParentFolder()
{
CPathStr path(GetFolder());
if (PathIsRoot(path))
path.Empty(); // show drive list
else
path.Append(_T(".."));
SetFolder(path);
}
示例7: OnMenu_Extract
/**
* "파일 풀기"를 눌렀을때 파일을 하나 푸는 함수
*/
void CFV_Select::OnMenu_Extract ()
{
int * pIndecies = NULL; /// 선택된 인덱스를 저장
CListBox * plistSel = NULL; /// 리스트 박스용
int nSelCnt = 0; /// 선택된 갯수
BYTE * btBuff = NULL; /// 임시버퍼
CVFS_Manager * pVFS = NULL; /// vfs파일 핸들
FILE * fp = NULL; /// 임시 파일포인터
VFileHandle *pVFH = NULL; /// vfs 파일핸들
CString strText = "", strFileName = "", strDir = ""; /// 스트링, 파일이름, 폴더
if(m_list.GetSelCount () > 0 && (plistSel = GetListBox ()) && (pVFS = ::g_pDlg_Main->GetVFS())
&&::g_pDlg_Main->GetSelectedVfsName ().GetLength () > 0)
{
/// 파일을 풀 디렉토리를 묻는다
if(GetFolder (&strDir, "파일을 풀 폴더를 선택하세요", GetSafeHwnd (), NULL, NULL))
{
/// 인덱스를 저장하기 위해서 메모리를 할당
if((pIndecies = new int[m_list.GetSelCount ()]))
{
/// 선택된 인덱스들을 가져옴
m_list.GetSelItems (m_list.GetSelCount (), pIndecies);
nSelCnt = m_list.GetSelCount ();
for(short i = 0; i < nSelCnt; i++)
{
strText = "";
/// 리스트박스에서 문자열을 가져옴
plistSel->GetText (pIndecies[ nSelCnt - 1 - i ], strText);
/// base file명만 불리해서 여기에 다시 저장하고 그리고 파일 생성할 때 사용한다
strFileName = strText;
if(strFileName.ReverseFind ('\\') >= 0)
{
strFileName = strFileName.Right (strFileName.GetLength () - strFileName.ReverseFind ('\\') - 1);
}
long lFileLength = pVFS->GetFileLength (strText.GetString ());
if(lFileLength >= 0 && (btBuff = new BYTE[ lFileLength ]))
{
if((pVFH = pVFS->OpenFile (strText.GetString ())))
{
vfread (btBuff, sizeof (BYTE), (size_t)lFileLength, pVFH);
_fmode = _O_BINARY;
if((fp = fopen (strDir + "\\" + strFileName, "w")))
{
fwrite (btBuff, sizeof(BYTE), (size_t)lFileLength, fp);
fclose (fp);
}
delete btBuff;
pVFS->CloseFile (pVFH);
}
}
}
delete pIndecies;
}
}
}
}
示例8: GetFolder
NS_IMETHODIMP nsNntpUrl::GetFolderCharsetOverride(bool *aCharacterSetOverride) {
nsCOMPtr<nsIMsgFolder> folder;
nsresult rv = GetFolder(getter_AddRefs(folder));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(folder, NS_ERROR_FAILURE);
rv = folder->GetCharsetOverride(aCharacterSetOverride);
NS_ENSURE_SUCCESS(rv, rv);
return rv;
}
示例9: GetFolder
PyObject* pyVault::GetAgeJournalsFolder()
{
PyObject * result = GetFolder(plVault::kAgeJournalsFolder);
// just return an empty node
if (!result)
result = pyVaultFolderNode::New(nil);
return result;
}
示例10: GetFolder
PyObject* pyVault::GetInbox( void )
{
PyObject * result = GetFolder(plVault::kInboxFolder);
// if good then return py object
if (result)
return result;
// otherwise return a None object
PYTHON_RETURN_NONE;
}
示例11: dc
int CFileBrowserListCtrl::CalcMinColumnWidth(int Col)
{
enum {
BORDER = 6, // minimal spacing; less causes abbreviated text
SLACK = 3 // prevents widest item from touching right edge
};
CWaitCursor wc; // iterating all items can be slow, especially for file type
CClientDC dc(this);
HGDIOBJ PrevFont = dc.SelectObject(GetFont()); // must use list control's font
int width = 0;
CSize sz;
CFileInfo FileInfo;
CString str;
int items = m_DirList.GetCount();
for (int i = 0; i < items; i++) {
const CDirItem& item = m_DirList.GetItem(i);
switch (Col) {
case COL_NAME:
str = item.GetName();
break;
case COL_SIZE:
if (item.IsDir())
continue;
FormatSize(item.GetLength(), str);
break;
case COL_TYPE: // slow if we have many unique file types that aren't cached
m_FileInfoCache.GetFileInfo(GetFolder(), item, FileInfo);
str = FileInfo.GetTypeName();
break;
case COL_MODIFIED:
if (item.GetLastWrite() == 0)
continue;
FormatTime(item.GetLastWrite(), str);
break;
default:
ASSERT(0);
}
GetTextExtentPoint32(dc.m_hDC, str, str.GetLength(), &sz);
if (sz.cx > width)
width = sz.cx;
}
dc.SelectObject(PrevFont); // restore DC's previous font
// 25feb09: GetItemRect can fail e.g. if list is empty, in which case we
// must avoid adding garbage to column width
CRect IconRect;
if (GetItemRect(0, IconRect, LVIR_ICON))
width += IconRect.Width();
else // can't get item rect, fall back to system metrics
width += GetSystemMetrics(m_ViewType == VTP_ICON ? SM_CXICON : SM_CXSMICON);
width += BORDER + SLACK;
return(width);
}
示例12: GetFolder
int CUpdateUtil::GetFolderSymbol(CString& strPath, CString& strReplace)
{
int retval = 0;
CString strCompare = strPath;
CString strCompareOriginal = strPath;
CString strCompareReplace = "";
if(*m_pbCancel)
{
retval = UPDATE_ERROR;
return retval;
}
int nStart = strCompare.Find('%');
if(nStart != -1 && nStart == 0)
{
int nEnd = strCompare.Find('%', nStart+1);
if(nEnd != -1)
{
strReplace = strCompare.Left(nEnd+1);
strCompare = strCompare.Left(nEnd);
strCompareReplace = strCompare.Right(strCompare.GetLength()-1);
retval = GetFolder(strCompareReplace);
}
else
retval = UPDATE_ERROR;
}
else
{
int nFindColon = strCompare.Find(':');
if(nFindColon !=-1 && nFindColon == 1)
{
retval = UPDATE_ERROR;
}
else
{
strReplace = "%CurrentDirectory%";
int nFind = strCompare.Find('\\');
if(nFind != -1 && nFind == 0)
{
strPath = strReplace + strCompareOriginal;
}
else
{
strPath = strReplace + "\\" + strCompareOriginal;
}
retval = UPDATE_CURRENTDIRECTORY;
}
}
return retval;
}
示例13: HeaderFolder2
void CRecBinViewer::InitInterfaces (void)
{
if (TRUE == GetFolder2 ())
HeaderFolder2 ();
else
if (TRUE == GetFolder ())
HeaderFolder ();
if (gFolderStateMan.IsIn (CONST_RECYCLEBIN))
gFolderStateMan.LoadState (CONST_RECYCLEBIN, m_State);
else
gFolderStateMan.SaveState (CONST_RECYCLEBIN, m_State);
}
示例14: SetTo
void
DPath::SetBaseName(const char *string)
{
if (IsEmpty())
{
SetTo(string);
return;
}
BString temp = GetFolder();
BString ext = GetExtension();
temp << "/" << string << "." << ext;
}
示例15: BuildExtList
W64INT CSaveAsDlg::DoModal()
{
BuildExtList();
if (m_psFolder != NULL) {
m_ofn.lpstrInitialDir = *m_psFolder;
m_ofn.Flags |= OFN_NOCHANGEDIR; // otherwise folder stays locked
}
W64INT retc = CFileDialog::DoModal();
if (retc == IDOK) {
if (m_psFolder != NULL)
GetFolder(*m_psFolder);
}
return(retc);
}