Debug时,HINSTANCE hinst = AfxGetInstanceHandle()一直报断言错误,原因是afxCurrentInstanceHandle为NULL。
解决方案:
HINSTANCE hinst = AfxGetInstanceHandle();
改为
HINSTANCE hinst = GetModuleHandle(NULL);
本文介绍了一个关于使用AfxGetInstanceHandle()函数时出现断言错误的问题及其解决方案。当afxCurrentInstanceHandle为空时,调用该函数会导致错误。解决方法是改用GetModuleHandle(NULL)来获取模块句柄。
Debug时,HINSTANCE hinst = AfxGetInstanceHandle()一直报断言错误,原因是afxCurrentInstanceHandle为NULL。
解决方案:
HINSTANCE hinst = AfxGetInstanceHandle();
改为
HINSTANCE hinst = GetModuleHandle(NULL);
5287

被折叠的 条评论
为什么被折叠?