|
为何ListView_SetImageList总返回 NULL
[复制链接]
代码如下:
- CListViewEx::CListViewEx(void)
- {
- m_hWnd = NULL;
- m_iImageNumber = 0;
- int size = ::GetSystemMetrics(SM_CXICON);
- m_himlLarge = ImageList_Create(size, size, ILC_COLOR, 0, 50);
- size = ::GetSystemMetrics(SM_CXSMICON);
- m_himlSmall = ImageList_Create(size, size, ILC_COLOR, 0, 50);
- INITCOMMONCONTROLSEX initCCEx;
- initCCEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
- initCCEx.dwICC = ICC_LISTVIEW_CLASSES;
- InitCommonControlsEx(&initCCEx);
- }
- BOOL CListViewEx::CreateCtrl(HINSTANCE hInstance, HWND hWnd, int x, int y, UINT cx, UINT cy, UINT ctrlId)
- {
- m_hParent = hWnd;
- m_hInst = hInstance;
- m_hWnd = CreateWindowEx(0, WC_LISTVIEW, TEXT (""),
- LVS_ICON |/* LVS_SINGLESEL |*/ LVS_OWNERDATA
- | WS_VISIBLE | WS_CHILD,
- x, y, cx, cy, hWnd, (HMENU)ctrlId, m_hInst, NULL);
- if(m_hWnd == NULL)
- {
- return FALSE;
- }
- ListView_SetImageList(m_hWnd, m_himlLarge, LVSIL_NORMAL);
- if(NULL == ListView_SetImageList(m_hWnd, m_himlSmall, LVSIL_SMALL))
- {
- DestroyWindow(m_hWnd);
- return FALSE;
- }
- return TRUE;
- }
复制代码
|
|