if using MFC AfxGetInstanceHandle(). For console programs, call GetConsoleWindow() to get the HWND then GetWindowLong() to get the HINSTANCE.
HINSTANCE hInst= GetModuleHandle (0);
For the Win32 API, you could also use GetModuleHandle():
HINSTANCE hInst= GetModuleHandle (0);
本文介绍了如何通过不同方法获取当前程序的实例句柄(HINSTANCE)。对于使用MFC的应用程序,可以通过AfxGetInstanceHandle()获取;对于控制台程序,则可以使用GetConsoleWindow()和GetWindowLong()组合实现;而在标准的Win32 API环境下,推荐使用GetModuleHandle()来直接获取。
&spm=1001.2101.3001.5002&articleId=7481583&d=1&t=3&u=f76615acc6574c849007fe68b47be364)
9246

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



