Titus Information Systems, Inc.

Standard Library
CDirectoryLocator Class

This base class is inherited from CDialog and provides public member functions and variables to show a dialog box from which the user may select a directory (folder) from the local machine or local area network.  It is especially useful for application installation or selecting a working directory upon application start up.  Do not inherit directly from this base class.  Instead, inherit from CDirectoryDialog or CDirectoryFind.  The member functions and variables available are as follows:

CDirectoryLocator::CDirectoryLocator(int id, CWnd*pParent = NULL)
This is the constructor.  It initializes the data members and links the dialog box to the specified parent window.
BOOL CDirectoryLocator::IsEmpty(CString path)
This public member function checks the directory (folder) specified in path to see if it is empty.  If the directory contains only the (.) and (..) directories, the function returns TRUE.  If the directory contains at least one directory or file regardless of attributes, the function returns FALSE.
BOOL CDirectoryLocator::IsDirectory(CString path)
This public member function checks the path name specified to see if it is a directory (folder).  If path points to an existing directory, the function returns TRUE.  If path points to an existing file (not a directory), the function displays an error message box and returns FALSE.  If path does not exist, a query message box is displayed with the message "Should (path) be created?"  If the user responds with "YES", the directory is created and the function returns TRUE.  If the user responds with "NO", the function creates nothing and returns FALSE.
BOOL CDirectoryLocator::MakeDirectory(CString path)
This public member function creates the directory (folder) specified by path.  It will create any directories necessary to insure that the full path exists as a directory.  If all directories are successfully created, the function returns TRUE.  If any directory creation attempts are unsuccessful, the function returns FALSE.
int CDirectoryLocator::RemovePath(CString Path, int Log = 0, CProgress*Prog = NULL)
This public member function deletes files.  It will also delete a directory (folder) even though the directory is not empty.  It supports wild cards in the terminating file name of Path both for files and directories.  Any files encountered to be deleted that have Read Only, System, or Hidden attributes set, will have those attributes cleared so that they can be deleted.  Please be advised that this program can be extremely dangerous!  For example, if you specify C:\*.* as Path, this program will remove every file not presently in use from your hard disk.  If Log is set to a number greater than zero, all files and directories deleted will be listed on the console to the number of levels specified by Log.  Prog is not presently used.
BOOL CDirectoryLocator::AttribPath(CString Path, BOOL SetCreate, CTime DateCreate, BOOL SetModify, CTime DateModify, BOOL SetAccess, CTime DateAccess, BOOL SetReadOnly, BOOL FlagReadOnly, BOOL SetHidden, BOOL FlagHidden, BOOL SetArchive, BOOL FlagArchive, BOOL SetSystem, BOOL FlagSystem, int Log = 0, CProgress*Prog = NULL)
This public member function sets the attributes of all the files specified in Path.  It supports wild cards in the terminating file name of Path.  If Log is set to a number greater than zero, all files modified will be listed on the console to the number of levels specified by Log.  Prog is not presently used.
virtual void CDirectoryLocator::DoDataExchange(CDataExchange* pDX)
This member function may be overridden.  If so, be sure the base class member function is called as it performs MFC Dynamic Data Exchange for the CDirectoryLocator::Tree and CDirectoryLocator::Path data members.
virtual BOOL CDirectoryLocator::OnInitDialog()
This member function may be overridden.  If so, be sure the base class member function is called as it performs MFC dialog box initialization for the CDirectoryLocator::Tree and CDirectoryLocator::Path data members.
afx_msg void CDirectoryLocator::OnExpanding(NMHDR* pNMHDR, LRESULT* pResult)
This member function may be overridden.  If so, be sure the base class member function is called as it expands the CDirectoryLocator::Tree data member and the displayed directory (folder) tree by scanning for and listing all the directories contained in the expanded directory.
afx_msg void CDirectoryLocator::OnClicked(NMHDR* pNMHDR, LRESULT* pResult)
This member function may be overridden.  If so, be sure the base class member function is called as it displays the full path of the selected directory in the CDirectoryLocator::Path data member and dialog edit box.
afx_msg void CDirectoryLocator::OnNew()
This member function may be overridden.  If so, be sure the base class member function is called as it displays the CDirectoryNew dialog box to create a new directory (folder) in the selected directory.
afx_msg void CDirectoryLocator::OnSelected(NMHDR* pNMHDR, LRESULT* pResult)
This member function may be overridden.  If so, be sure the base class member function is called as it stores the currently selected directory (folder) in the CDirectoryLocator::Path data member and terminates the dialog box (performs an "OK").
int CDirectoryLocator::Code
This data member may be inherited.  It is used by the base class to store the return code from various API function calls.
CString CDirectoryLocator::HoldPath
This data member may be inherited.  It is used by the base class to store the current path temporarily from time to time.
HICON CDirectoryLocator::Icon
This data member may be inherited.  It is used to store the Icon passed to the class in various functions.
CString CDirectoryLocator::Path
This data member may be inherited.  It is used to store the current directory (folder) path that is being processed by any function.
CTreeCtrl CDirectoryLocator::Tree
This data member may be inherited.  It is the storage for the Tree Control used by the dialog box.
BOOL CDirectoryLocator::UseIcon
This data member may be inherited.  It indicates whether or not the Icon data member is used by the dialog box.


[ CBinaryFile | TCommandLineInfo | CCommaFile | TDateCtrl | CDDE | CDdeClient | CDdeServer ]
[ CDirectoryDialog | CDirectoryFind | CDirectoryNew | CFileCopy | TFrameWnd ]
[ InterfaceExcel | CMaintFn | CPrintFile | CProcDialog | TPrintDialog | CProcPropertyPage ]
[ CProgress | CRegistry | CSDisCreate | CSDisFile | CSDisPage | CSDisView | CTableFile ]
[ CTaskIcon | TPresent | TTime | TDate | TDateTime | CTransferData | TWinApp | CXlTable ]

[ Stand-alone Programs | Standard Library | Conversion Functions | Utility Functions | COBOL Functions ]
[ Windows NT Library | COBOL Library | COBOL Interface | Command Prompt Abbreviations | Purchase Instructions ]

[ Home | Areas of Expertise | "We Do Windows" | Clients and Projects | Software Samples | Package Software Available ]
[ Contact Information | Business Software Philosophy | Church Software Philosophy ]
All contents of this web site are Copyright © Titus Information Systems, Inc., Phoenix, Arizona, U.S.A.