Exemple #1
0
 CString ToRelative(LPCTSTR dir, const LPCTSTR path, bool* pbRelative/* = nullptr*/)
 {
     CPath cp;
     BOOL rel = cp.RelativePathTo(dir, FILE_ATTRIBUTE_DIRECTORY, path, 0);
     if (pbRelative) {
         *pbRelative = !!rel;
     }
     return cp;
 }
void CPPageWebServer::OnBnClickedButton1()
{
	CString dir = GetCurWebRoot();
	if(PickDir(dir)) {
		CPath path;
		if(path.RelativePathTo(GetMPCDir(), FILE_ATTRIBUTE_DIRECTORY, dir, FILE_ATTRIBUTE_DIRECTORY)) {
			dir = (LPCTSTR)path;
		}
		m_WebRoot = dir;
		UpdateData(FALSE);
	}
}