Visit the Ultimate Toolbox main page for an overview and configuration guide to the Ultimate Toolbox library.
Source code and project files for this sample are included in the samples\file\URLDemo directory of the sample projects download.
COXURL class represents a URL (like the one you use in your Internet browser).
It can divide a URL into different parts or compose a new URL from its parts.
The three parts of a URL are:
The protocol and port are important when using TCP/IP. Another important part is the UNC which can also be used separately.
URL and UNC classes represent a file (or other resource). A full URL (Uniform Resource locator) and a UNC (Universal Naming Convention) supports a new base class for file management functions useful to build applications that conform to the Win95 specifications (which requires UNC support). They are also useful to add internet functionality to your application.
COXURL classes are simple to use - the samples\file\URLDemo sample simply includes
OXIteratorUNC.h headers and declares temporary objects to parse the string to show the 'splitting' functionality for UNC and URL strings:
UNC = m_sURL_UNC;
UNC.URLPart() = m_bURLPart;
m_sServer = UNC.Server();
m_sShare = UNC.Share();
m_sDirectory = UNC.Directory();
m_sFile = UNC.File();
m_sBaseName = UNC.Base();
m_sExtension = UNC.Extension();
m_bURLPart = UNC.URLPart();
The full functionality of the UNC class includes a lot of actions on the actual files or directories like create, delete, rename, move, get directories, and change size, attributes and file times.
URL = m_sURL_UNC;
m_sProtocol = URL.Protocol();
m_nPort = URL.Port();
m_sServer = URL.UNC().Server();
m_sShare = URL.UNC().Share();
m_sDirectory = URL.UNC().Directory();
m_sFile = URL.UNC().File();
m_sBaseName = URL.UNC().Base();
m_sExtension = URL.UNC().Extension();
m_bURLPart = URL.UNC().URLPart();
m_sURL_UNC = URL;
A complete class reference for the
COXUNC and related classes is available in the compiled HTML documentation.
Initial CodeProject release August 2007.