Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Ribbonbar Recent file list problem Collapse All
Subject Author Date
Shailesh Nikam Apr 23, 2007 - 7:06 AM


If I’m creating file in under some some child folder like

d:\config spec\test data\hello\1.dd then file name is appearing like d:\config spec\...\1.dd
When I will click on that recent file I want complete file name. I have written below code. Can you tell me how to retrieve complete file name from recent files list

        CRecentFileList * pRecentFileList = InternalFriendlyWinApp::_GetFriendlyApp()->_GetRecentFileList();
        CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryGroup =
        wndRG.ItemInsert( NULL, strTemp, (HICON) NULL );
        if( pRecentFileList != NULL )
            int nRecentCount = pRecentFileList->GetSize();
            TCHAR sCurrDir[_MAX_PATH+1];
            int nLenCurDir = (int)_tcslen(sCurrDir);
            for( int nItemIndex=0; nItemIndex<nRecentCount; nItemIndex++ )
                CExtSafeString sDisplayName( _T("") );
                if(!pRecentFileList->GetDisplayName(*((CString *)&sDisplayName),nItemIndex,sCurrDir,nLenCurDir, TRUE ))
                ASSERT( !sDisplayName.IsEmpty() );
                CExtToolBoxWnd::TOOLBOX_ITEM_DATA * pTBCI_GalleryItem =
                wndRG.ItemInsert( pTBCI_GalleryGroup, sDisplayName, (HICON)NULL );
                ASSERT( pTBCI_GalleryItem != NULL );
            wndRG.ItemExpand( pTBCI_GalleryGroup );
            wndRG.ItemSetActive( pTBCI_GalleryGroup );
            wndRG.UpdateToolBoxWnd( true );            

Technical Support Apr 29, 2007 - 10:01 AM

You should use another approach for processing the recent file list events. The recent file list contains two string arrays of equal size. The first one contains display names for menu with dots inside long paths and you can get these display names using the CRecentFileList::GetDisplayName() method. The second array contains full paths and you can get each of them using the CRecentFileList::operator[] method:

CRecentFileList * pRFL = . . .
int nIndex = . . .
CString strDisplayNameForMenu = pRFL->GetDisplayName( nIndex );
CString strRealFullPath = ( * pRFL ) [ nIndex ];

Shailesh Nikam Apr 24, 2007 - 12:24 PM


Even this function is also not returning proper and complete file path.
Please tell me where shall I put _fullpath code because OnRibbonGalleryInitContent() this function is reading values but some values contains
"d:\test session\...\1.db" How to extract the name. If I use ::AfxFullPath or _tfullpath then also I’m getting value as d:\test session\...\1.db

I want complete path name should come. Can you send me sample application for the same.


Shailesh Nikam Apr 24, 2007 - 12:21 AM


I wrote below code but still I’m getting name as "d:\config spec\...\1.dd" instead of d:\config spec\test data\hello\1.dd
Can you tell me whats wrong with below code. And I have put below code in OnRibbonGalleryItemSelEndOk() function.

TCHAR szTemp[255];
::AfxFullPath(szTemp,LPCTSTR(pTBCI->TextGet()) );

Technical Support Apr 24, 2007 - 11:54 AM

You can use _tfullpath() macro function which is mapped to the _fullpath() or _wfullpath() functions depending on the character system (msdn):

       char *_fullpath( 
            char *absPath,
            const char *relPath,
            size_t maxLength 
      wchar_t *_wfullpath( 
            wchar_t *absPath,
            const wchar_t *relPath,
            size_t maxLength 

Shailesh Nikam Apr 23, 2007 - 7:36 AM

And my Recent file selection code is as below

void CSimOfficeRibbonBar::OnRibbonGalleryItemSelEndOK(
CExtRibbonGalleryWnd & wndRG,
CExtRibbonGalleryPopupMenuWnd * pGalleryPopup,
CExtRibbonButtonGallery * pRibbonGalleryTBB,
    CWinApp* pApp = ::AfxGetApp();
    pGalleryPopup->DestroyWindow() ;
    pApp->OpenDocumentFile( LPCTSTR(pTBCI->TextGet()) );

As show above I’m passing the name thats appearing in my recent file list window. So can you tell me how to retrieve correct file name?

Technical Support Apr 23, 2007 - 10:08 AM

Here is a function provided by MFC for retrieving the full path:

BOOL AFXAPI AfxFullPath(LPTSTR lpszPathOut, LPCTSTR lpszFileIn);
You can get the relative file path from toolbox item’s text and convert it into the full path.