//获取路径 std::string GetApplicationDir() { HMODULE hModule = GetModuleHandleW(NULL); WCHAR wpath[MAX_PATH]; GetModuleFileNameW(hModule, wpath, MAX_PATH); std::wstring wide(wpath); std::string path = CefString(wide); path = path.substr( 0, path.find_last_of("\/") ); return path; }
获取配置ini文件
//这里配置网址 2014-06-04 std::string path=GetApplicationDir(); std::string File = std::string("\httpUrl.ini"); std::string pathFile = path+File; char strUrl[100]; int i= ::GetPrivateProfileStringA("config","url","",strUrl,100, pathFile.data()); //这里要注意 //pathFile.data()是const char*类型如果定义在外面如下: //const char* pa=pathFile.data()或const char* pa=pathFile.c_str()