Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
RecentFileList.cpp
Package: MiniCAD_ALL.zip [view]
Upload User: netltd
Upload Date: 2013-02-12
Package Size: 7234k
Code Size: 2k
Category:
Graph Drawing
Development Platform:
Visual C++
- #include "stdafx.h"
- #include "RecentFileList.h"
- void CRecentFileListEx::UpdateMenu(CCmdUI* pCmdUI)
- {
- int index = 0;
- ASSERT(m_arrNames != NULL);
- //注意不是pCmdUI->m_pMenu
- CMenu* pMenu = pCmdUI->m_pSubMenu;
- if (m_strOriginal.IsEmpty() && pMenu != NULL)
- pMenu->GetMenuString(pCmdUI->m_nID, m_strOriginal, MF_BYCOMMAND);
- if (m_arrNames[0].IsEmpty())
- {
- // no MRU files
- if (!m_strOriginal.IsEmpty())
- pCmdUI->SetText(m_strOriginal);
- pCmdUI->Enable(FALSE);
- return;
- }
- if (pCmdUI->m_pSubMenu == NULL)
- return;
- for (int iMRU = 0; iMRU < m_nSize; iMRU++)
- pCmdUI->m_pSubMenu->DeleteMenu(pCmdUI->m_nID + iMRU, MF_BYCOMMAND);
- TCHAR szCurDir[_MAX_PATH];
- GetCurrentDirectory(_MAX_PATH, szCurDir);
- int nCurDir = lstrlen(szCurDir);
- ASSERT(nCurDir >= 0);
- szCurDir[nCurDir] = '\';
- szCurDir[++nCurDir] = '';
- CString strName;
- CString strTemp;
- for (iMRU = 0; iMRU < m_nSize; iMRU++)
- {
- if (!GetDisplayName(strName, iMRU, szCurDir, nCurDir))
- break;
- // double up any '&' characters so they are not underlined
- LPCTSTR lpszSrc = strName;
- LPTSTR lpszDest = strTemp.GetBuffer(strName.GetLength()*2);
- while (*lpszSrc != 0)
- {
- if (*lpszSrc == '&')
- *lpszDest++ = '&';
- if (_istlead(*lpszSrc))
- *lpszDest++ = *lpszSrc++;
- *lpszDest++ = *lpszSrc++;
- }
- *lpszDest = 0;
- strTemp.ReleaseBuffer();
- // insert mnemonic + the file name
- TCHAR buf[10];
- wsprintf(buf, _T("&%d "), (iMRU+1+m_nStart) % 10);
- pCmdUI->m_pSubMenu->InsertMenu(pCmdUI->m_nIndex++,
- MF_STRING | MF_BYPOSITION, pCmdUI->m_nID++,
- CString(buf) + strTemp);
- }
- // update end menu count
- pCmdUI->m_nIndex--; // point to last menu added
- pCmdUI->m_nIndexMax = pCmdUI->m_pSubMenu->GetMenuItemCount();
- pCmdUI->m_bEnableChanged = TRUE; // all the added items are enabled
- }