解决debug时AfxGetInstanceHandle()报debug Assert Failed错误

来源:互联网 发布:易语言管理系统源码 编辑:程序博客网 时间:2024/06/10 14:50

 if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
 {
  // TODO: change error code to suit your needs
  _tprintf(_T("Fatal Error: MFC initialization failed/n"));
 }//解决Win32调用程序GetModuleFileName会在Degug崩溃的错误;加上就不会debug时候AfxGetInstanceHandle()有那个debug Assert Failed错误


 char path[_MAX_PATH];
 GetModuleFileName(NULL,path,_MAX_PATH);
 string strFile;
 strFile = path;
 
 int k = strFile.rfind('//');
 string strpath = strFile.substr(0,k); 

原创粉丝点击