1.取得当前目录 char szModulePath [_MAX_PATH]; /* Path of Module */ // Get current module handle HMODULE module = GetModuleHandle(0); // Get current file path GetModuleFileName(module, szModulePath, sizeof(szModulePath)); CString strPath = szModulePath; strPath = strPath.Left(strPath.ReverseFind(_T('//'))); lstrcpy(szModulePath, strPath.GetBuffer(strPath.GetLength())); 2.取得操作系统盘符 TCHAR sysDir[128]; GetSystemDirectory(sysDir, 128 * sizeof(TCHAR)); CString sysDisk = sysDir[0]; sysDisk.MakeUpper();