CImageList m_ImageList1;
m_ImageList1.Create(32,32,ILC_COLOR,5,1);
HICON hIcon1=CMy2App::LoadIcon(IDR_MY2TYPE);
m_ImageList1.Add(hIcon1);
编译以后出错:
D:\vc\1\2.cpp(194) : error C2352: 'CWinApp::LoadIconA' : illegal call of non-static member function
g:\microsoft visual studio\vc98\mfc\include\afxwin.h(4099) : see declaration of 'LoadIconA'
Error executing cl.exe.
为什么啊?
我用的是LoadIcon
怎么变成LoadIconA啦??
请指教
谢谢
m_ImageList1.Create(32,32,ILC_COLOR,5,1);
HICON hIcon1=CMy2App::LoadIcon(IDR_MY2TYPE);
m_ImageList1.Add(hIcon1);
编译以后出错:
D:\vc\1\2.cpp(194) : error C2352: 'CWinApp::LoadIconA' : illegal call of non-static member function
g:\microsoft visual studio\vc98\mfc\include\afxwin.h(4099) : see declaration of 'LoadIconA'
Error executing cl.exe.
为什么啊?
我用的是LoadIcon
怎么变成LoadIconA啦??
请指教
谢谢
同时解释一下为何是LoadIconA:我这里仿真Windows源代码,给出伪码:
#ifdef _UNICODE
#define LoadIcon LoadIconA
#else
#define LoadIcon LoadIconW
#endif所有Windows API都有两份代码,一份用于char(A结尾),一份用于wchar_t(W结尾)。然而在底层实现时,char版会调用wchar_t版。
所以,如果你没有在编译时带参数-D _UICONDE,那么你的LoadIcon实际在底层是LoadIconA