|
-
August 6th, 2011, 02:44 PM
#1
Cannot create listview control
Hi all,
i wouldlike to create a listview control but the createwindow function return null 
Code:
hWndListView = CreateWindow(WC_LISTVIEW,WC_LISTVIEW,WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |LVS_REPORT | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_SINGLESEL, 0,0,300,300,hwnd,NULL,h, NULL);
if (hWndListView == NULL)
MessageBox(hwnd,"Oooops","",MB_OK);
I am coding with Dev-C++.
-
August 6th, 2011, 04:36 PM
#2
Re: Cannot create listview control
 Originally Posted by ledaker
Hi all,
i wouldlike to create a listview control but the createwindow function return null
Code:
hWndListView = CreateWindow(WC_LISTVIEW,WC_LISTVIEW,WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |LVS_REPORT | LVS_AUTOARRANGE | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_SINGLESEL, 0,0,300,300,hwnd,NULL,h, NULL);
if (hWndListView == NULL)
(hwnd,"Oooops","",MB_OK);
I am coding with Dev-C++.
Well, your MessageBox doesn't make any sense.
From MSDN (CreateWindow Function):
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Victor Nijegorodov
-
August 7th, 2011, 11:48 AM
#3
Re: Cannot create listview control
While I am new to vc++ myself, I have created a listview control.
try to see if your input handle to hwnd is valid.
make sure h your instance handle is valid.
I would remove some of the styles and see what you get.
here is some code I used in my program
hTemp = CreateWindow(WC_LISTVIEW, L"List", WS_CHILD | WS_VISIBLE | LVS_REPORT , 45 + 35, 148 + 122, 240, 110, hDlg, (HMENU)Direct_List_ID, hInst, NULL);
//note: Direct_List_ID is useful if you plan on making reference to the control later in receiving notification messages.
if all else is lost refer to the source for listviews
http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx
Last edited by JPatchSPSU; August 7th, 2011 at 11:51 AM.
Reason: spelling
-
August 8th, 2011, 03:48 AM
#4
Re: Cannot create listview control
Appropriate InitCommonControlsEx call is required prior to create common controls.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|