HRESULT _stdcall CContainer::Drop(IDataObject *pDataObject,DWORD grfKeyState, POINTL pt,DWORD *pdwEffect) { TCHITTESTINFO tchi; TCITEM tcItem; TCHAR szDestDirectory[MAX_PATH]; int iTab; m_pDropTargetHelper->Drop(pDataObject,(POINT *)&pt,*pdwEffect); tchi.pt.x = pt.x; tchi.pt.y = pt.y; ScreenToClient(m_hTabCtrl,&tchi.pt); iTab = TabCtrl_HitTest(m_hTabCtrl,&tchi); if(iTab != -1) { tcItem.mask = TCIF_PARAM; TabCtrl_GetItem(m_hTabCtrl,iTab,&tcItem); m_pShellBrowser[(int)tcItem.lParam]->QueryCurrentDirectory(SIZEOF_ARRAY(szDestDirectory), szDestDirectory); } else { return S_OK; } if(m_bDataAccept) { IDropHandler *pDropHandler = NULL; pDropHandler = new CDropHandler(); pDropHandler->Drop(pDataObject, grfKeyState,pt,pdwEffect,m_hTabCtrl, m_DragType,szDestDirectory, NULL,FALSE); pDropHandler->Release(); } return S_OK; }
// If a custom name has been set, that will be returned. Otherwise, the // display name of the current directory will be returned. std::wstring Tab::GetName() const { if (m_useCustomName) { return m_customName; } PIDLPointer pidlDirectory(m_shellBrowser->QueryCurrentDirectoryIdl()); TCHAR name[MAX_PATH]; HRESULT hr = GetDisplayName(pidlDirectory.get(), name, SIZEOF_ARRAY(name), SHGDN_INFOLDER); if (FAILED(hr)) { return L"(Unknown)"; } return name; }
HRESULT CDropHandler::CopyAnsiTextData(IDataObject *pDataObject, list<PastedFile_t> *pPastedFileList) { STGMEDIUM stg; HRESULT hr; hr = pDataObject->GetData(&m_ftcText,&stg); if(hr == S_OK) { char *pText = static_cast<char *>(GlobalLock(stg.hGlobal)); if(pText != NULL) { WCHAR *pszUnicodeText = new WCHAR[strlen(pText) + 1]; MultiByteToWideChar(CP_ACP,0,pText,-1,pszUnicodeText, static_cast<int>(strlen(pText) + 1)); TCHAR szFullFileName[MAX_PATH]; hr = CopyTextToFile(m_szDestDirectory,pszUnicodeText,szFullFileName); if(hr == S_OK) { PastedFile_t pf; StringCchCopy(pf.szFileName,SIZEOF_ARRAY(pf.szFileName),szFullFileName); PathStripPath(pf.szFileName); pPastedFileList->push_back(pf); } delete[] pszUnicodeText; GlobalUnlock(stg.hGlobal); } ReleaseStgMedium(&stg); } return hr; }
/* Processes an items filename. Essentially checks if the extension (if any) needs to be removed, and removes it if it does. */ TCHAR *CShellBrowser::ProcessItemFileName(int iItemInternal) const { BOOL bHideExtension = FALSE; TCHAR *pExt = NULL; TCHAR *pszDisplay = NULL; if(m_bHideLinkExtension && ((m_pwfdFiles[iItemInternal].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)) { pExt = PathFindExtension(m_pExtraItemInfo[iItemInternal].szDisplayName); if(*pExt != '\0') { if(lstrcmpi(pExt,_T(".lnk")) == 0) bHideExtension = TRUE; } } /* We'll hide the extension, provided it is meant to be hidden, and the filename does not begin with a period, and the item is not a directory. */ if((!m_bShowExtensions || bHideExtension) && m_pExtraItemInfo[iItemInternal].szDisplayName[0] != '.' && (m_pwfdFiles[iItemInternal].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { static TCHAR szDisplayName[MAX_PATH]; StringCchCopy(szDisplayName,SIZEOF_ARRAY(szDisplayName), m_pExtraItemInfo[iItemInternal].szDisplayName); /* Strip the extension. */ PathRemoveExtension(szDisplayName); /* The item will now be shown without its extension. */ pszDisplay = szDisplayName; } else { pszDisplay = m_pExtraItemInfo[iItemInternal].szDisplayName; } return pszDisplay; }
void CDisplayWindow::OnSetThumbnailFile(WPARAM wParam,LPARAM lParam) { m_bShowThumbnail = (BOOL)lParam; if(m_bShowThumbnail) { CancelThumbnailExtraction(); if(m_hbmThumbnail) DeleteObject(m_hbmThumbnail); m_iImageWidth = 0; m_iImageHeight = 0; m_bThumbnailExtracted = FALSE; m_bThumbnailExtractionFailed = FALSE; StringCchCopy(m_ImageFile,SIZEOF_ARRAY(m_ImageFile), (TCHAR *)wParam); } }
void CMyTreeView::DirectoryAlteredCallback(TCHAR *szFileName,DWORD dwAction, void *pData) { DirectoryAltered_t *pDirectoryAltered = NULL; CMyTreeView *pMyTreeView = NULL; TCHAR szFullFileName[MAX_PATH]; pDirectoryAltered = (DirectoryAltered_t *)pData; pMyTreeView = (CMyTreeView *)pDirectoryAltered->pMyTreeView; StringCchCopy(szFullFileName, SIZEOF_ARRAY(szFullFileName), pDirectoryAltered->szPath); if(!PathAppend(szFullFileName, szFileName)) { return; } pMyTreeView->DirectoryModified(dwAction,szFullFileName); }
BOOL CContainer::DeleteBookmarkSafe(HWND hwnd,void *pBookmarkHandle) { TCHAR szInfoMsg[128]; int iMessageBoxReturn; LoadString(g_hLanguageModule,IDS_BOOKMARK_DELETE, szInfoMsg,SIZEOF_ARRAY(szInfoMsg)); iMessageBoxReturn = MessageBox(hwnd,szInfoMsg, WINDOW_NAME,MB_YESNO|MB_ICONINFORMATION|MB_DEFBUTTON2); if(iMessageBoxReturn == IDYES) { m_Bookmark.DeleteBookmark(pBookmarkHandle); return TRUE; } return FALSE; }
BOOL CALLBACK CIPBookmarkItemNotifier::BookmarkNotifierEnumWindows(HWND hwnd,void *pData,UINT uSize) { TCHAR szClassName[256]; int iRes = GetClassName(hwnd,szClassName,SIZEOF_ARRAY(szClassName)); if(iRes != 0 && lstrcmp(szClassName,NExplorerplusplus::CLASS_NAME) == 0 && hwnd != m_hTopLevelWnd && m_pipbng->GetIPBroadcast()) { COPYDATASTRUCT cds; cds.lpData = pData; cds.cbData = uSize; cds.dwData = NULL; SendMessage(hwnd,WM_COPYDATA,reinterpret_cast<WPARAM>(m_hTopLevelWnd),reinterpret_cast<LPARAM>(&cds)); } return TRUE; }
void Explorerplusplus::OnTreeViewCopyItemPath(void) { HTREEITEM hItem; LPITEMIDLIST pidl; TCHAR szFullFileName[MAX_PATH]; hItem = TreeView_GetSelection(m_hTreeView); if(hItem != NULL) { pidl = m_pMyTreeView->BuildPath(hItem); GetDisplayName(pidl,szFullFileName,SIZEOF_ARRAY(szFullFileName),SHGDN_FORPARSING); CopyTextToClipboard(szFullFileName); CoTaskMemFree(pidl); } }
INT_PTR CSplitFileDialog::OnPrivateMessage(UINT uMsg,WPARAM wParam,LPARAM lParam) { UNREFERENCED_PARAMETER(lParam); switch(uMsg) { case NSplitFileDialog::WM_APP_SETTOTALSPLITCOUNT: SendDlgItemMessage(m_hDlg,IDC_SPLIT_PROGRESS,PBM_SETRANGE32,0,wParam); break; case NSplitFileDialog::WM_APP_SETCURRENTSPLITCOUNT: SendDlgItemMessage(m_hDlg,IDC_SPLIT_PROGRESS,PBM_SETPOS,wParam,0); break; case NSplitFileDialog::WM_APP_SPLITFINISHED: OnSplitFinished(); break; case NSplitFileDialog::WM_APP_INPUTFILEINVALID: { TCHAR szTemp[128]; LoadString(GetInstance(),IDS_SPLITFILEDIALOG_INPUTFILEINVALID, szTemp,SIZEOF_ARRAY(szTemp)); SetDlgItemText(m_hDlg,IDC_SPLIT_STATIC_MESSAGE,szTemp); assert(m_pSplitFile != NULL); m_pSplitFile->Release(); m_pSplitFile = NULL; m_bSplittingFile = false; m_bStopSplitting = false; KillTimer(m_hDlg,ELPASED_TIMER_ID); SetDlgItemText(m_hDlg,IDOK,m_szOk); } break; } return 0; }
COggSplitter::COggSplitter(LPUNKNOWN pUnk, HRESULT *phr) : CBaseFilter(NAME("Ogg Splitter"), pUnk, &m_csFilter, CLSID_OggSplitter), CPersistPropertyBag(arOggSplitterProps, SIZEOF_ARRAY(arOggSplitterProps), &CLSID_OggSplitter), CRegistryStuff(&CLSID_OggSplitter), m_rtStart((REFERENCE_TIME)0), m_rtStop(_I64_MAX/2), m_rtDuration(_I64_MAX/2), m_dRate(1), m_pLastSeek(NULL) { if (SUCCEEDED(*phr)) { COggSplitInputPin *pIn = new COggSplitInputPin(NAME("In"), this, &m_csFilter, phr, L"In"); if (!pIn) *phr = E_OUTOFMEMORY; else { if (SUCCEEDED(*phr)) m_pInput = pIn; else delete pIn; } } m_paOutput = NULL; m_iOutputs = 0; m_paStream = NULL; m_iStreams = 0; m_pChapterInfo = NULL; m_iChapters = 0; m_bStopPauseRunCalled = false; m_bChaptersAsStreams = true; LoadFromRegistry(idSeekToKeyFrame, &m_bAlwaysSearchToKeyFrame, true); LoadFromRegistry(idAlwaysEnableAllStreams, &m_bAlwaysEnableAllStreams, false); LoadFromRegistry(idShowTrayIcon, &m_bShowTrayIcon, true); m_bEnableAll = m_bAlwaysEnableAllStreams; if (m_bShowTrayIcon) InitTrayIcon(); }
void CMyTreeView::AddItem(const TCHAR *szFullFileName) { TCHAR szDirectory[MAX_PATH]; HTREEITEM hParent; HTREEITEM hDeskParent; /* If the specified item is a drive, it will need to be handled differently, as it is a child of my computer (and as such is not a regular file). */ if(PathIsRoot(szFullFileName)) { AddDrive(szFullFileName); } else { StringCchCopy(szDirectory, SIZEOF_ARRAY(szDirectory), szFullFileName); PathRemoveFileSpec(szDirectory); // Check if it is a desktop (sub)child hDeskParent = LocateItemOnDesktopTree(szDirectory); hParent = LocateExistingItem(szDirectory); /* If this items' parent isn't currently shown on the treeview and the item is not on the desktop, exit without doing anything further. */ if(hParent == NULL && hDeskParent == NULL) return; AddItemInternal(hParent,szFullFileName); if(hDeskParent != NULL) { /* If the item is on the desktop, it is a special case. We need to update the treeview also starting from the root item. */ AddItemInternal(hDeskParent,szFullFileName); } } }
void CManageBookmarksDialog::OnNewFolder() { TCHAR szTemp[64]; LoadString(GetInstance(),IDS_BOOKMARKS_NEWBOOKMARKFOLDER,szTemp,SIZEOF_ARRAY(szTemp)); CBookmarkFolder NewBookmarkFolder = CBookmarkFolder::Create(szTemp); /* Save the folder GUID, so that it can be selected and placed into edit mode once the bookmark notification comes through. */ m_bNewFolderAdded = true; m_guidNewFolder = NewBookmarkFolder.GetGUID(); HWND hTreeView = GetDlgItem(m_hDlg,IDC_BOOKMARK_TREEVIEW); HTREEITEM hSelectedItem = TreeView_GetSelection(hTreeView); assert(hSelectedItem != NULL); CBookmarkFolder &ParentBookmarkFolder = m_pBookmarkTreeView->GetBookmarkFolderFromTreeView( hSelectedItem); ParentBookmarkFolder.InsertBookmarkFolder(NewBookmarkFolder); }
/* Saves a set of strings to the registry. Returns something other than ERROR_SUCCESS on failure. If this function does fail, any values that have been written will not be deleted (i.e. this function is not transactional). */ LONG NRegistrySettings::SaveStringListToRegistry(HKEY hKey,const TCHAR *szBaseKeyName, const std::list<std::wstring> &strList) { TCHAR szItemKey[128]; LONG lRes; int i = 0; for(const auto &str : strList) { StringCchPrintf(szItemKey,SIZEOF_ARRAY(szItemKey),_T("%s%d"), szBaseKeyName,i++); lRes = SaveStringToRegistry(hKey,szItemKey,str.c_str()); if(lRes != ERROR_SUCCESS) { return lRes; } } return ERROR_SUCCESS; }
INT_PTR CUpdateCheckDialog::OnInitDialog() { SetDlgItemText(m_hDlg,IDC_STATIC_CURRENT_VERSION,VERSION_STRING_W); TCHAR szTemp[64]; LoadString(GetInstance(),IDS_UPDATE_CHECK_STATUS,szTemp,SIZEOF_ARRAY(szTemp)); SetDlgItemText(m_hDlg,IDC_STATIC_UPDATE_STATUS,szTemp); SetTimer(m_hDlg,0,STATUS_TIMER_ELAPSED,NULL); /* The actual version check will be performed in a background thread (to avoid blocking the main thread while the version file is downloaded). */ HANDLE hThread = CreateThread(NULL,0,UpdateCheckThread, reinterpret_cast<LPVOID>(m_hDlg),0,NULL); CloseHandle(hThread); m_pucdps->RestoreDialogPosition(m_hDlg,false); return 0; }
TEST(GetItemAttributes, Simple) { TCHAR szFullFileName[MAX_PATH]; GetTestResourceFilePath(L"Metadata.jpg", szFullFileName, SIZEOF_ARRAY(szFullFileName)); SFGAOF attributes; HRESULT hr = GetItemAttributes(szFullFileName, &attributes); ASSERT_TRUE(SUCCEEDED(hr)); /* Since the exact list of attributes can vary by operating system version (i.e. newer versions of Windows can return newer properties), simply check that a few sample properties are present. */ EXPECT_TRUE((attributes & SFGAO_CANCOPY) != 0); EXPECT_TRUE((attributes & SFGAO_FILESYSTEM) != 0); EXPECT_FALSE((attributes & SFGAO_FOLDER) != 0); EXPECT_FALSE((attributes & SFGAO_LINK) != 0); }
/** * Loads the settings from the (global) extra data area of VirtualBox. * * If an error occurs while accessing extra data area, the method immediately * returns and the vbox argument will hold all error info (and therefore * vbox.isOk() will be false to indicate this). * * If an error occurs while setting the value of some property, the method * also returns immediately. #operator !() will return false in this case * and #lastError() will contain the error message. * * @note This method emits the #propertyChanged() signal. */ void VBoxGlobalSettings::load (CVirtualBox &vbox) { for (size_t i = 0; i < SIZEOF_ARRAY(gPropertyMap); i++) { QString value = vbox.GetExtraData(gPropertyMap[i].publicName); if (!vbox.isOk()) return; /* Check for the host key upgrade path. */ if ( value.isEmpty() && QString(gPropertyMap[i].publicName) == "GUI/Input/HostKeyCombination") value = vbox.GetExtraData("GUI/Input/HostKey"); /* Empty value means the key is absent. It is OK, the default will * apply. */ if (value.isEmpty()) continue; /* Try to set the property validating it against rx. */ setPropertyPrivate(i, value); if (!(*this)) break; } }
void CShellBrowser::DetermineItemExtensionGroup(int iItemInternal,TCHAR *szGroupHeader,int cchMax) const { TCHAR FullFileName[MAX_PATH]; TCHAR *pExt; StringCchCopy(FullFileName,SIZEOF_ARRAY(FullFileName),m_CurDir); PathAppend(FullFileName,m_pwfdFiles[iItemInternal].cFileName); pExt = PathFindExtension(FullFileName); /* TODO: Folder? */ if(*pExt == '\0') { /* TODO: Move into string table. */ StringCchCopy(szGroupHeader,cchMax,_T("None")); } else { StringCchCopy(szGroupHeader,cchMax,pExt); } }
HRESULT CSwapAPODllModule::DllUnregisterServer(BOOL bUnRegTypeLib) throw() { HRESULT hResult; UINT32 u32APOUnregIndex = 0; // Unregister the module. hResult = CAtlDllModuleT<CSwapAPODllModule>::UnregisterServer(bUnRegTypeLib); if (FAILED(hResult)) { goto Exit; } // Unregister all the APOs that are implemented in this module. for (u32APOUnregIndex = 0; u32APOUnregIndex < SIZEOF_ARRAY(gCoreAPOs); u32APOUnregIndex++) { hResult = UnregisterAPO(gCoreAPOs[u32APOUnregIndex]->clsid); ATLASSERT(SUCCEEDED(hResult)); } Exit: return hResult; } // DllUnregisterServer
/* Retrieves the filename of the first file been dropped. */ void CContainer::GetSourceFileName(IDataObject *pDataObject) { FORMATETC ftc; STGMEDIUM stg; DROPFILES *pdf = NULL; HRESULT hr; int nDroppedFiles; ftc.cfFormat = CF_HDROP; ftc.ptd = NULL; ftc.dwAspect = DVASPECT_CONTENT; ftc.lindex = -1; ftc.tymed = TYMED_HGLOBAL; hr = pDataObject->GetData(&ftc,&stg); if(hr == S_OK) { pdf = (DROPFILES *)GlobalLock(stg.hGlobal); if(pdf != NULL) { /* Request a count of the number of files that have been dropped. */ nDroppedFiles = DragQueryFile((HDROP)pdf,0xFFFFFFFF,NULL,NULL); if(nDroppedFiles >= 1) { /* Determine the name of the first dropped file. */ DragQueryFile((HDROP)pdf,0,m_pszSource, SIZEOF_ARRAY(m_pszSource)); } GlobalUnlock(stg.hGlobal); } ReleaseStgMedium(&stg); } }
void Explorerplusplus::OnTreeViewPaste(void) { HTREEITEM hItem; LPITEMIDLIST pidl = NULL; TCHAR szFullFileName[MAX_PATH + 1]; hItem = TreeView_GetSelection(m_hTreeView); if(hItem != NULL) { IDataObject *pClipboardObject = NULL; HRESULT hr = OleGetClipboard(&pClipboardObject); if(hr == S_OK) { CDropHandler *pDropHandler = CDropHandler::CreateNew(); pidl = m_pMyTreeView->BuildPath(hItem); assert(pidl != NULL); GetDisplayName(pidl,szFullFileName,SIZEOF_ARRAY(szFullFileName),SHGDN_FORPARSING); /* Name must be double NULL terminated. */ szFullFileName[lstrlen(szFullFileName) + 1] = '\0'; pDropHandler->CopyClipboardData(pClipboardObject, m_hTreeView,szFullFileName,NULL, !m_bOverwriteExistingFilesConfirmation); CoTaskMemFree(pidl); pDropHandler->Release(); pClipboardObject->Release(); } } }
void LightOPCGroup::set_active(BOOL act) { unsigned ii; LightOPCItem *oi; int aqual = OPC_QUALITY_OUT_OF_SERVICE; // UL_DEBUG((LOG_GRHO("set_active(%u, %ls)"), act, loWnul(name))); if (act = act != 0) aqual = -1; if (act == Active) return; if (owner->se->driver.ldSubscribe) { for(ii = itl.gl_count; ii;) { unsigned ch; loTagId chact[32]; for(ch = 0; ch < SIZEOF_ARRAY(chact) && ii; ) if ((oi = (LightOPCItem*)itl.gl_list[--ii]) && oi->bActive) chact[ch++] = oi->tid, oi->Quality = aqual, oi->TouchChanged(); if (ch) loChangeActivity(&owner->ctxt.cactx, act, ch, chact); } } else if (act) for(ii = itl.gl_count; ii;) if (oi = (LightOPCItem*)itl.gl_list[--ii]) oi->Quality = -1, oi->TouchChanged(); Active = act; if (Active /*&& 0 != (advise_present & advise_enabled)*/) actuate_async(1); // UL_DEBUG((LOG_GRHO("set_active(%u, %ls), finished"), act, loWnul(name))); }
/* Changes the font within the search edit control, and sets the default text. */ void CManageBookmarksDialog::SetSearchFieldDefaultState() { HWND hEdit = GetDlgItem(m_hDlg,IDC_MANAGEBOOKMARKS_EDITSEARCH); LOGFONT lf; HFONT hCurentFont = reinterpret_cast<HFONT>(SendMessage(hEdit,WM_GETFONT,0,0)); GetObject(hCurentFont,sizeof(lf),reinterpret_cast<LPVOID>(&lf)); HFONT hPrevEditSearchFont = m_hEditSearchFont; lf.lfItalic = TRUE; m_hEditSearchFont = CreateFontIndirect(&lf); SendMessage(hEdit,WM_SETFONT,reinterpret_cast<WPARAM>(m_hEditSearchFont),MAKEWORD(TRUE,0)); if(hPrevEditSearchFont != NULL) { DeleteFont(hPrevEditSearchFont); } TCHAR szTemp[64]; LoadString(GetInstance(),IDS_MANAGE_BOOKMARKS_DEFAULT_SEARCH_TEXT,szTemp,SIZEOF_ARRAY(szTemp)); SetWindowText(hEdit,szTemp); }
HRESULT _stdcall CMyTreeView::Drop(IDataObject *pDataObject,DWORD grfKeyState, POINTL pt,DWORD *pdwEffect) { TVHITTESTINFO tvht; LPITEMIDLIST pidlDirectory = NULL; TCHAR szDestDirectory[MAX_PATH + 1]; KillTimer(m_hTreeView,DRAGEXPAND_TIMER_ID); tvht.pt.x = pt.x; tvht.pt.y = pt.y; ScreenToClient(m_hTreeView,(LPPOINT)&tvht.pt); TreeView_HitTest(m_hTreeView,&tvht); /* Is the mouse actually over an item? */ if(!(tvht.flags & LVHT_NOWHERE) && (tvht.hItem != NULL) && m_bDataAccept) { pidlDirectory = BuildPath(tvht.hItem); GetDisplayName(pidlDirectory,szDestDirectory,SIZEOF_ARRAY(szDestDirectory),SHGDN_FORPARSING); CDropHandler *pDropHandler = CDropHandler::CreateNew(); pDropHandler->Drop(pDataObject, grfKeyState,pt,pdwEffect,m_hTreeView, m_DragType,szDestDirectory,NULL,FALSE); pDropHandler->Release(); CoTaskMemFree(pidlDirectory); } RestoreState(); m_pDropTargetHelper->Drop(pDataObject,(POINT *)&pt,*pdwEffect); return S_OK; }
HRESULT CDropHandler::CopyUnicodeTextData(IDataObject *pDataObject, list<PastedFile_t> *pPastedFileList) { STGMEDIUM stg; HRESULT hr; hr = pDataObject->GetData(&m_ftcUnicodeText,&stg); if(hr == S_OK) { WCHAR *pText = static_cast<WCHAR *>(GlobalLock(stg.hGlobal)); if(pText != NULL) { TCHAR szFullFileName[MAX_PATH]; hr = CopyTextToFile(m_szDestDirectory,pText,szFullFileName); if(hr == S_OK) { PastedFile_t pf; StringCchCopy(pf.szFileName,SIZEOF_ARRAY(pf.szFileName),szFullFileName); PathStripPath(pf.szFileName); pPastedFileList->push_back(pf); } GlobalUnlock(stg.hGlobal); } ReleaseStgMedium(&stg); } return hr; }
int Explorerplusplus::OnTreeViewEndLabelEdit(LPARAM lParam) { NMTVDISPINFO *pdi = NULL; TCHAR NewFileName[MAX_PATH]; pdi = (NMTVDISPINFO *)lParam; /* No text was entered, so simply notify the control to revert to the previous text. */ if(pdi->item.pszText == NULL) return FALSE; /* Build the new filename from the text entered and the parent directory component of the old filename. */ StringCchCopy(NewFileName,SIZEOF_ARRAY(NewFileName),m_OldTreeViewFileName); PathRemoveFileSpec(NewFileName); BOOL bRes = PathAppend(NewFileName,pdi->item.pszText); if(!bRes) { return FALSE; } CFileActionHandler::RenamedItem_t RenamedItem; RenamedItem.strOldFilename = m_OldTreeViewFileName; RenamedItem.strNewFilename = NewFileName; TrimStringRight(RenamedItem.strNewFilename,_T(" ")); std::list<CFileActionHandler::RenamedItem_t> RenamedItemList; RenamedItemList.push_back(RenamedItem); m_FileActionHandler.RenameFiles(RenamedItemList); return TRUE; }
int CListViewEdit::GetExtensionIndex() { TCHAR szFileName[MAX_PATH]; GetWindowText(m_hwnd,szFileName,SIZEOF_ARRAY(szFileName)); DWORD dwAttributes = m_pexpp->GetActiveShellBrowser()->QueryFileAttributes(m_ItemIndex); int Index = -1; if((dwAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) { for(int i = lstrlen(szFileName) - 1;i >= 0;i--) { if(szFileName[i] == '.') { Index = i; break; } } } return Index; }
void CSearchDialog::SaveEntry(int comboBoxId, boost::circular_buffer<std::wstring> &buffer) { TCHAR entry[MAX_PATH]; GetDlgItemText(m_hDlg, comboBoxId, entry, SIZEOF_ARRAY(entry)); std::wstring strEntry(entry); auto itr = std::find_if(buffer.begin(), buffer.end(), [strEntry] (const std::wstring Pattern) { return Pattern.compare(strEntry) == 0; }); HWND hComboBox = GetDlgItem(m_hDlg, comboBoxId); ComboBox_SetCurSel(hComboBox, -1); if(itr != buffer.end()) { /* Remove the current element from both the list and the combo box. It will be reinserted at the front of both below. */ auto index = std::distance(buffer.begin(), itr); SendMessage(hComboBox, CB_DELETESTRING, index, 0); buffer.erase(itr); } buffer.push_front(entry); SendMessage(hComboBox, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(entry)); ComboBox_SetCurSel(hComboBox, 0); ComboBox_SetEditSel(hComboBox, -1, -1); if(ComboBox_GetCount(hComboBox) > buffer.capacity()) { SendMessage(hComboBox, CB_DELETESTRING, ComboBox_GetCount(hComboBox) - 1, 0); } }
INT_PTR CFilterDialog::OnInitDialog() { HIMAGELIST himl = ImageList_Create(16,16,ILC_COLOR32|ILC_MASK,0,48); HBITMAP hBitmap = LoadBitmap(GetModuleHandle(0),MAKEINTRESOURCE(IDB_SHELLIMAGES)); ImageList_Add(himl,hBitmap,NULL); m_hDialogIcon = ImageList_GetIcon(himl,SHELLIMAGES_FILTER,ILD_NORMAL); SetClassLongPtr(m_hDlg,GCLP_HICONSM,reinterpret_cast<LONG_PTR>(m_hDialogIcon)); DeleteObject(hBitmap); ImageList_Destroy(himl); HWND hComboBox = GetDlgItem(m_hDlg,IDC_FILTER_COMBOBOX); SetFocus(hComboBox); for each(auto strFilter in m_pfdps->m_FilterList) { SendMessage(hComboBox,CB_ADDSTRING,static_cast<WPARAM>(-1), reinterpret_cast<LPARAM>(strFilter.c_str())); } TCHAR szFilter[512]; m_pexpp->GetActiveShellBrowser()->GetFilter(szFilter,SIZEOF_ARRAY(szFilter)); ComboBox_SelectString(hComboBox,-1,szFilter); SendMessage(hComboBox,CB_SETEDITSEL,0,MAKELPARAM(0,-1)); if (m_pexpp->GetActiveShellBrowser()->GetFilterCaseSensitive()) CheckDlgButton(m_hDlg,IDC_FILTERS_CASESENSITIVE,BST_CHECKED); m_pfdps->RestoreDialogPosition(m_hDlg,true); return 0; }
void Explorerplusplus::OnTBGetInfoTip(LPARAM lParam) { NMTBGETINFOTIP *ptbgit = reinterpret_cast<NMTBGETINFOTIP *>(lParam); StringCchCopy(ptbgit->pszText,ptbgit->cchTextMax,EMPTY_STRING); if(ptbgit->iItem == TOOLBAR_BACK) { if(m_pActiveShellBrowser->IsBackHistory()) { LPITEMIDLIST pidl = m_pActiveShellBrowser->RetrieveHistoryItemWithoutUpdate(-1); TCHAR szPath[MAX_PATH]; GetDisplayName(pidl,szPath,SIZEOF_ARRAY(szPath),SHGDN_INFOLDER); TCHAR szInfoTip[1024]; TCHAR szTemp[64]; LoadString(m_hLanguageModule,IDS_MAIN_TOOLBAR_BACK,szTemp,SIZEOF_ARRAY(szTemp)); StringCchPrintf(szInfoTip,SIZEOF_ARRAY(szInfoTip),szTemp,szPath); StringCchCopy(ptbgit->pszText,ptbgit->cchTextMax,szInfoTip); } } else if(ptbgit->iItem == TOOLBAR_FORWARD) { if(m_pActiveShellBrowser->IsForwardHistory()) { LPITEMIDLIST pidl = m_pActiveShellBrowser->RetrieveHistoryItemWithoutUpdate(1); TCHAR szPath[MAX_PATH]; GetDisplayName(pidl,szPath,SIZEOF_ARRAY(szPath),SHGDN_INFOLDER); TCHAR szInfoTip[1024]; TCHAR szTemp[64]; LoadString(m_hLanguageModule,IDS_MAIN_TOOLBAR_FORWARD,szTemp,SIZEOF_ARRAY(szTemp)); StringCchPrintf(szInfoTip,SIZEOF_ARRAY(szInfoTip),szTemp,szPath); StringCchCopy(ptbgit->pszText,ptbgit->cchTextMax,szInfoTip); } } }