Error

C++博客 首页 新随笔 联系 聚合 管理
  217 Posts :: 61 Stories :: 32 Comments :: 0 Trackbacks
void FixWorkingDir()
{
HANDLE hCurrentExe = ::GetModuleHandle(NULL);
std::tstring strFileName;
std::tstring strPath;
strFileName.resize(MAX_PATH*2, 0);
::GetModuleFileName((HMODULE)hCurrentExe, const_cast<TCHAR*>(strFileName.data()), strFileName.size());
auto nPosEnd = strFileName.find_last_of(_T('\\'));
if (std::tstring::npos != nPosEnd)
{
strPath = strFileName.substr(0, nPosEnd);
::SetCurrentDirectory(strPath.c_str());
}
else
{
XASSERT_MSG(false, _T("windows did not have root path, \\ must be found"));
}
}
posted on 2015-06-06 20:58 Enic 阅读(567) 评论(0)  编辑 收藏 引用 所属分类: 从零开始写棋牌游戏平台

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理